From: Eric Dumazet <dada1@cosmosbay.com>
To: Ravikiran G Thirumalai <kiran@scalex86.org>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, dipankar@in.ibm.com,
bharata@in.ibm.com, shai@scalex86.org,
Rusty Russell <rusty@rustcorp.com.au>,
netdev@vger.kernel.org, davem@davemloft.net
Subject: Re: [patch 7/11] net: Use bigrefs for net_device.refcount
Date: Tue, 13 Sep 2005 20:27:52 +0200 [thread overview]
Message-ID: <43271A28.9090301@cosmosbay.com> (raw)
In-Reply-To: <20050913161012.GI3570@localhost.localdomain>
Ravikiran G Thirumalai a écrit :
> The net_device has a refcnt used to keep track of it's uses.
> This is used at the time of unregistering the network device
> (module unloading ..) (see netdev_wait_allrefs) .
> For loopback_dev , this refcnt increment/decrement is causing
> unnecessary traffic on the interlink for NUMA system
> affecting it's performance. This patch improves tbench numbers by 6% on a
> 8way x86 Xeon (x445).
===================================================================
> --- alloc_percpu-2.6.13.orig/include/linux/netdevice.h 2005-08-28 16:41:01.000000000 -0700
> +++ alloc_percpu-2.6.13/include/linux/netdevice.h 2005-09-12 11:54:21.000000000 -0700
> @@ -37,6 +37,7 @@
> #include <linux/config.h>
> #include <linux/device.h>
> #include <linux/percpu.h>
> +#include <linux/bigref.h>
>
> struct divert_blk;
> struct vlan_group;
> @@ -377,7 +378,7 @@
> /* device queue lock */
> spinlock_t queue_lock;
> /* Number of references to this device */
> - atomic_t refcnt;
> + struct bigref netdev_refcnt;
> /* delayed register/unregister */
> struct list_head todo_list;
> /* device name hash chain */
> @@ -677,11 +678,11 @@
Hum...
Did you tried to place refcnt/netdev_refcnt in a separate cache line than
queue_lock ? I got good results too...
> /* device queue lock */
> spinlock_t queue_lock;
> /* Number of references to this device */
> - atomic_t refcnt;
> + struct bigref netdev_refcnt ____cacheline_aligned_in_smp ;
> /* delayed register/unregister */
> struct list_head todo_list;
> /* device name hash chain */
Every time a cpu take the queue_lock spinlock, it exclusively gets one cache
line. If another cpu try to access netdev_refcnt, it has to grab this cache
line (even if properely per_cpu designed, there is still one shared field). In
fact the whole struct net_device should be re-ordered for SMP/NUMA performance.
Eric
next prev parent reply other threads:[~2005-09-13 18:27 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20050913155112.GB3570@localhost.localdomain>
2005-09-13 16:10 ` [patch 7/11] net: Use bigrefs for net_device.refcount Ravikiran G Thirumalai
2005-09-13 16:26 ` Stephen Hemminger
2005-09-13 16:35 ` Ben Greear
2005-09-13 16:46 ` Stephen Hemminger
2005-09-13 20:26 ` David S. Miller
2005-09-13 22:16 ` Ravikiran G Thirumalai
2005-09-13 18:27 ` Eric Dumazet [this message]
2005-09-13 18:53 ` Ravikiran G Thirumalai
2005-09-13 16:12 ` [patch 8/11] net: dst_abstraction macros Ravikiran G Thirumalai
2005-09-13 16:17 ` [patch 9/11] net: dst_entry.refcount, use, lastuse to use alloc_percpu Ravikiran G Thirumalai
2005-09-13 20:24 ` David S. Miller
2005-09-13 22:07 ` Ravikiran G Thirumalai
2005-09-13 22:12 ` David S. Miller
2005-09-13 23:17 ` Ravikiran G Thirumalai
2005-09-13 23:27 ` David S. Miller
2005-09-14 7:21 ` Rusty Russell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=43271A28.9090301@cosmosbay.com \
--to=dada1@cosmosbay.com \
--cc=akpm@osdl.org \
--cc=bharata@in.ibm.com \
--cc=davem@davemloft.net \
--cc=dipankar@in.ibm.com \
--cc=kiran@scalex86.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=rusty@rustcorp.com.au \
--cc=shai@scalex86.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).