From patchwork Fri May 7 09:51:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 51905 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 2DCADB7D42 for ; Fri, 7 May 2010 19:51:31 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756280Ab0EGJv0 (ORCPT ); Fri, 7 May 2010 05:51:26 -0400 Received: from mail-bw0-f219.google.com ([209.85.218.219]:42585 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755571Ab0EGJvZ (ORCPT ); Fri, 7 May 2010 05:51:25 -0400 Received: by bwz19 with SMTP id 19so465031bwz.21 for ; Fri, 07 May 2010 02:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:subject:from:to:cc :in-reply-to:references:content-type:date:message-id:mime-version :x-mailer:content-transfer-encoding; bh=9ZVxmC+qozLZ2D+C5N+ZXRy5M6t1zwMCbJmcJDP2bMY=; b=F6y1FEHYJ6j7LMrq1Q6QX6PxQOKfexVbJu5wGxWH7g/Em85rEyXQ3AY2ksIXTbQPa2 4cgSTOt14j2Kiqg04qrkcBwvfSAblgskFTnM4R63k99sVSdKrKqEhIBiyLODtJUaI/Hy rtZloOEJid9Fyyj7QD6LyYj3O/kb+1G5urURM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:to:cc:in-reply-to:references:content-type:date :message-id:mime-version:x-mailer:content-transfer-encoding; b=Bw5H+m1AQ6aDOl7cAaioWrgzwudojOb4MzJRGkS32BXDtW9bevFqKd1roIM0EPOz2N T1SpnONObgfgeeKvqapGL53en1TZ17oRNiQnMB722TfJdw4My0nl9yXunb+FHDTbGrIg 3MAPI0AL1ChDndEVk6/6a/wD0nsIJElSbpamk= Received: by 10.204.162.199 with SMTP id w7mr1703195bkx.211.1273225883745; Fri, 07 May 2010 02:51:23 -0700 (PDT) Received: from [127.0.0.1] (gw1.cosmosbay.com [212.99.114.194]) by mx.google.com with ESMTPS id 16sm665688bwz.9.2010.05.07.02.51.22 (version=SSLv3 cipher=RC4-MD5); Fri, 07 May 2010 02:51:23 -0700 (PDT) Subject: [PATCH net-next-2.6] rps: avoid one atomic in enqueue_to_backlog From: Eric Dumazet To: David Miller Cc: netdev@vger.kernel.org, therbert@google.com In-Reply-To: <1273209375.2222.37.camel@edumazet-laptop> References: <1273136322.2357.15.camel@edumazet-laptop> <20100506.220759.25136752.davem@davemloft.net> <1273209375.2222.37.camel@edumazet-laptop> Date: Fri, 07 May 2010 11:51:21 +0200 Message-ID: <1273225881.2261.39.camel@edumazet-laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Le vendredi 07 mai 2010 à 07:16 +0200, Eric Dumazet a écrit : > Le jeudi 06 mai 2010 à 22:07 -0700, David Miller a écrit : > > > Looks great, applied, thanks Eric. > > Thanks, I have a followup to avoid one atomic in enqueue phase too ;) > [PATCH net-next-2.6] rps: avoid one atomic in enqueue_to_backlog If CONFIG_SMP=y, then we own a queue spinlock, we can avoid the atomic test_and_set_bit() from napi_schedule_prep(). We now have same number of atomic ops per netif_rx() calls than with pre-RPS kernel. Signed-off-by: Eric Dumazet --- -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/core/dev.c b/net/core/dev.c index 32611c8..49fa5a6 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2426,8 +2426,10 @@ enqueue: return NET_RX_SUCCESS; } - /* Schedule NAPI for backlog device */ - if (napi_schedule_prep(&sd->backlog)) { + /* Schedule NAPI for backlog device + * We can use non atomic operation since we own the queue lock + */ + if (!__test_and_set_bit(NAPI_STATE_SCHED, &sd->backlog.state)) { if (!rps_ipi_queued(sd)) ____napi_schedule(sd, &sd->backlog); }