netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netfilter: don't need to initialize instance_table
@ 2010-12-09 10:10 Changli Gao
  2010-12-09 14:03 ` Jan Engelhardt
  2010-12-09 19:56 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Changli Gao @ 2010-12-09 10:10 UTC (permalink / raw)
  To: Patrick McHardy; +Cc: David S. Miller, netfilter-devel, netdev, Changli Gao

Since instance_table is a static array, and has been zeroed already, we
don't need to take CPU cycles to initialize it.

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
---
 net/netfilter/nfnetlink_queue.c |    3 ---
 1 file changed, 3 deletions(-)
diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
index 68e67d1..9c80d6f 100644
--- a/net/netfilter/nfnetlink_queue.c
+++ b/net/netfilter/nfnetlink_queue.c
@@ -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) {

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] netfilter: don't need to initialize instance_table
  2010-12-09 10:10 [PATCH] netfilter: don't need to initialize instance_table Changli Gao
@ 2010-12-09 14:03 ` Jan Engelhardt
  2010-12-09 14:27   ` Changli Gao
  2010-12-09 19:56 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2010-12-09 14:03 UTC (permalink / raw)
  To: Changli Gao; +Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev

On Thursday 2010-12-09 11:10, Changli Gao wrote:

>Since instance_table is a static array, and has been zeroed already, we
>don't need to take CPU cycles to initialize it.
>
>Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>---
> net/netfilter/nfnetlink_queue.c |    3 ---
> 1 file changed, 3 deletions(-)
>diff --git a/net/netfilter/nfnetlink_queue.c b/net/netfilter/nfnetlink_queue.c
>index 68e67d1..9c80d6f 100644
>--- a/net/netfilter/nfnetlink_queue.c
>+++ b/net/netfilter/nfnetlink_queue.c
>@@ -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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] netfilter: don't need to initialize instance_table
  2010-12-09 14:03 ` Jan Engelhardt
@ 2010-12-09 14:27   ` Changli Gao
  2010-12-09 20:05     ` David Miller
  0 siblings, 1 reply; 5+ messages in thread
From: Changli Gao @ 2010-12-09 14:27 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: Patrick McHardy, David S. Miller, netfilter-devel, netdev

On Thu, Dec 9, 2010 at 10:03 PM, Jan Engelhardt <jengelh@medozas.de> wrote:
>
> 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.

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] netfilter: don't need to initialize instance_table
  2010-12-09 10:10 [PATCH] netfilter: don't need to initialize instance_table Changli Gao
  2010-12-09 14:03 ` Jan Engelhardt
@ 2010-12-09 19:56 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2010-12-09 19:56 UTC (permalink / raw)
  To: xiaosuo; +Cc: kaber, netfilter-devel, netdev

From: Changli Gao <xiaosuo@gmail.com>
Date: Thu,  9 Dec 2010 18:10:21 +0800

> Since instance_table is a static array, and has been zeroed already, we
> don't need to take CPU cycles to initialize it.
> 
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>

Adding a dependency on the implementation of HLISTs is not a good
idea, I would not apply this patch.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] netfilter: don't need to initialize instance_table
  2010-12-09 14:27   ` Changli Gao
@ 2010-12-09 20:05     ` David Miller
  0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2010-12-09 20:05 UTC (permalink / raw)
  To: xiaosuo; +Cc: jengelh, kaber, netfilter-devel, netdev

From: Changli Gao <xiaosuo@gmail.com>
Date: Thu, 9 Dec 2010 22:27:24 +0800

> On Thu, Dec 9, 2010 at 10:03 PM, Jan Engelhardt <jengelh@medozas.de> wrote:
>>
>> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-12-09 20:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-09 10:10 [PATCH] netfilter: don't need to initialize instance_table Changli Gao
2010-12-09 14:03 ` Jan Engelhardt
2010-12-09 14:27   ` Changli Gao
2010-12-09 20:05     ` David Miller
2010-12-09 19:56 ` David Miller

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).