I've found a much easier way to shrink the net_device structure
rather that moving all the operations out of it. However, since
the net_device may grow further, moving the operations into a
separate place may look reasonable.
The pahole tool showed, that there are a 124 and 80 bytes holes
before the queue_lock and the _xmit_lock respectively. Moving most
of the devices callbacks into the 2nd hole makes the sizeof of the
structure be 1024 bytes.
The hard_start_xmit callback is not moved to keep it in previous
cacheline.
I think it's OK to make such a reordering, since all these hooks
are a) read-only and b) not called on fast paths, so their place
within the structure looks not very important.
Unfortunately diff makes the patch look like moving other fields,
rater than the ops :)
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
include/linux/netdevice.h | 47 +++++++++++++++++++++++----------------------
1 files changed, 24 insertions(+), 23 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8b17ed4..3397919 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -483,9 +483,6 @@ struct net_device
struct list_head napi_list;
#endif
- /* The device initialization function. Called only once. */
- int (*init)(struct net_device *dev);
-
/* ------- Fields preinitialized in Space.c finish here ------- */
/* Net device features */
@@ -641,27 +638,9 @@ struct net_device
int watchdog_timeo; /* used by dev_watchdog() */
struct timer_list watchdog_timer;
-/*
- * refcnt is a very hot point, so align it on SMP
- */
- /* Number of references to this device */
- atomic_t refcnt ____cacheline_aligned_in_smp;
-
- /* delayed register/unregister */
- struct list_head todo_list;
- /* device index hash chain */
- struct hlist_node index_hlist;
-
- struct net_device *link_watch_next;
-
- /* register/unregister state machine */
- enum { NETREG_UNINITIALIZED=0,
- NETREG_REGISTERED, /* completed register_netdevice */
- NETREG_UNREGISTERING, /* called unregister_netdevice */
- NETREG_UNREGISTERED, /* completed unregister todo */
- NETREG_RELEASED, /* called free_netdev */
- } reg_state;
+ /* The device initialization function. Called only once. */
+ int (*init)(struct net_device *dev);
/* Called after device is detached from network. */
void (*uninit)(struct net_device *dev);
/* Called after last user reference disappears. */
@@ -703,6 +682,28 @@ struct net_device
unsigned short vid);
int (*neigh_setup)(struct net_device *dev, struct neigh_parms *);
+
+/*
+ * refcnt is a very hot point, so align it on SMP
+ */
+ /* Number of references to this device */
+ atomic_t refcnt ____cacheline_aligned_in_smp;
+
+ /* delayed register/unregister */
+ struct list_head todo_list;
+ /* device index hash chain */
+ struct hlist_node index_hlist;
+
+ struct net_device *link_watch_next;
+
+ /* register/unregister state machine */
+ enum { NETREG_UNINITIALIZED=0,
+ NETREG_REGISTERED, /* completed register_netdevice */
+ NETREG_UNREGISTERING, /* called unregister_netdevice */
+ NETREG_UNREGISTERED, /* completed unregister todo */
+ NETREG_RELEASED, /* called free_netdev */
+ } reg_state;
+
#ifdef CONFIG_NETPOLL
struct netpoll_info *npinfo;
#endif
--
1.5.3.4
--
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
| Karl Meyer | PROBLEM: 2.6.23-rc "NETDEV WATCHDOG: eth0: transmit timed out" |
| Greg Kroah-Hartman | [PATCH 040/196] kobject: add kobject_add_ng function |
| Steven Rostedt | [RFC PATCH v4] Unified trace buffer |
| Dave Airlie | [git pull] drm patches for 2.6.27 final |
| Krzysztof Halasa | Re: [PATCH v2] Re: WAN: new PPP code for generic HDLC |
| David Miller | Re: [PATCH] Expose netdevice dev_id through sysfs |
| Jay Cliburn | Re: atl1 64-bit => 32-bit DMA borkage (reproducible, bisected) |
| Evgeniy Polyakov | [resend take 2 0/4] Distributed storage. |
git: | |
| Andrew Morton | Untracked working tree files |
| Miklos Vajna | [rfc] git submodules howto |
| Ben Collins | Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins |
| Jon Smirl | ! [rejected] master -> master (non-fast forward) |
| rancor | How to copy/pipe console buffert to file? |
| Pieter Verberne | File collision while using pkg_add |
| Greg Thomas | Re: Is it possible to fix a stale NFS hadle without rebooting? |
| Didier Wiroth | win32-codecs, avi and amd64 question |
| Netfilter kernel module | 10 hours ago | Linux kernel |
| serial driver xmit problem | 12 hours ago | Linux kernel |
| Why Windows is better than Linux | 12 hours ago | Linux general |
| How can I see my kernel messages in vt12? | 19 hours ago | Linux kernel |
| Grub | 1 day ago | Linux general |
| vmalloc_fault handling in x86_64 | 1 day ago | Linux kernel |
| epoll_wait()ing on epoll FD | 1 day ago | Linux kernel |
| Framebuffer in x86_64 causes problems to multiseat | 1 day ago | Linux kernel |
| Difference between 2.4 and 2.6 regarding thread creation | 1 day ago | Linux general |
| Compiling gfs2 on kernel 2.6.27 | 2 days ago | Linux kernel |
