netfilter: don't need to initialize instance_table
Subsystems (3)
PATCH 1/1 netfilter: don't need to initialize instance_table
Since instance_table is a static array, and has been zeroed already, we don't need to take CPU cycles to initialize it.
--- net/netfilter/nfnetlink_queue.c | 3 --- 1 file changed, 3 deletions(-)
net/netfilter/nfnetlink_queue.c +0 -3
@@ -893,9 +893,6 @@ static int __init nfnetlink_queue_init(void) {int i, status = -ENOMEM ; -for (i =0 ; i <INSTANCE_BUCKETS ; i++) -INIT_HLIST_HEAD (&instance_table[i]); -netlink_register_notifier (&nfqnl_rtnl_notifier); status =nfnetlink_subsys_register (&nfqnl_subsys);if (status <0 ) {
Quoted 12 lines · Changli Gao
Since
instance_tableis a static array, and has been zeroed already, we don't need to take CPU cycles to initialize it.Signed-off-by Changli Gao <[email protected]>---
net/netfilter/nfnetlink_queue.c| 3 ---1 file changed, 3 deletions(-)net/netfilter/nfnetlink_queue.c +0
-0
net/netfilter/nfnetlink_queue.c static int __init nfnetlink_queue_init(void) · line 898
Quoted 9 lines
net/netfilter/nfnetlink_queue.c +0
-3@@ -893,9 +893,6 @@ static int __init nfnetlink_queue_init(void) {int i, status = -ENOMEM ; -for (i =0 ; i <INSTANCE_BUCKETS ; i++) -INIT_HLIST_HEAD (&instance_table[i]); -netlink_register_notifier (&nfqnl_rtnl_notifier); status =nfnetlink_subsys_register (&nfqnl_subsys);if (status <0 ) {
This is here for correctness and documentation. If the hlist implementation changed, one would have a hard time figuring out the callsites which then need to add the initialization back.
Quoted 5 lines · Jan Engelhardt
This is here for correctness and documentation. If the hlist implementation changed, one would have a hard time figuring out the callsites which then need to add the initialization back.
I am quite sure there are other users rely on this assumption. So who wants to change the macro INIT_HLIST_HEAD() has to review all the code. It is a huge task, but can't be avoided.
For now, calling INIT_HLIST_HEAD() has no benefit, but wastes CPU cycles and increases the image size.
Thanks.
Signature · 2 lines
Regards, Changli Gao([email protected])
David Miller
maintainerFrom: Changli Gao <[email protected]>
Date: Thu, 9 Dec 2010 22:27:24 +0800
Quoted 10 lines · Jan Engelhardt
Quoted 5 lines
This is here for correctness and documentation. If the hlist implementation changed, one would have a hard time figuring out the callsites which then need to add the initialization back.
I am quite sure there are other users rely on this assumption. So who wants to change the macro
INIT_HLIST_HEAD()has to review all the code. It is a huge task, but can't be avoided.
Wrong. Adding debugging facilities to the hlist head would just require changing this macro.
That is, unless we apply patches like your's, which we won't.
David Miller
maintainerFrom: Changli Gao <[email protected]>
Date: Thu, 9 Dec 2010 18:10:21 +0800
Quoted 4 lines
Since
instance_tableis a static array, and has been zeroed already, we don't need to take CPU cycles to initialize it.Signed-off-by Changli Gao <[email protected]>
Adding a dependency on the implementation of HLISTs is not a good idea, I would not apply this patch.