netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] sky2: rtnl_lock out of loop will be faster
@ 2007-12-12  8:50 Wang Chen
  2007-12-12 16:30 ` Stephen Hemminger
  2007-12-14 21:17 ` Jeff Garzik
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Chen @ 2007-12-12  8:50 UTC (permalink / raw)
  To: David S. Miller, Jeff Garzik; +Cc: shemminger, netdev, Wang Chen

[PATCH 4/4] [NETDEV] sky2: rtnl_lock out of loop will be faster

Before this patch, it gets and releases the lock at each
iteration of the loop. Changing unregister_netdev to
unregister_netdevice and locking outside of the loop will
be faster for this approach.

Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
---
 sky2.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

--- linux-2.6.24.rc5.org/drivers/net/sky2.c	2007-12-12 10:19:43.000000000 +0800
+++ linux-2.6.24.rc5/drivers/net/sky2.c	2007-12-12 15:23:37.000000000 +0800
@@ -4270,8 +4270,10 @@ static void __devexit sky2_remove(struct
 	del_timer_sync(&hw->watchdog_timer);
 	cancel_work_sync(&hw->restart_work);
 
+	rtnl_lock();
 	for (i = hw->ports-1; i >= 0; --i)
-		unregister_netdev(hw->dev[i]);
+		unregister_netdevice(hw->dev[i]);
+	rtnl_unlock();
 
 	sky2_write32(hw, B0_IMSK, 0);


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

* Re: [PATCH 4/4] sky2: rtnl_lock out of loop will be faster
  2007-12-12  8:50 [PATCH 4/4] sky2: rtnl_lock out of loop will be faster Wang Chen
@ 2007-12-12 16:30 ` Stephen Hemminger
  2007-12-13  6:26   ` Wang Chen
  2007-12-14 21:17 ` Jeff Garzik
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2007-12-12 16:30 UTC (permalink / raw)
  To: Wang Chen; +Cc: David S. Miller, Jeff Garzik, netdev, Wang Chen

On Wed, 12 Dec 2007 16:50:09 +0800
Wang Chen <wangchen@cn.fujitsu.com> wrote:

> [PATCH 4/4] [NETDEV] sky2: rtnl_lock out of loop will be faster
> 
> Before this patch, it gets and releases the lock at each
> iteration of the loop. Changing unregister_netdev to
> unregister_netdevice and locking outside of the loop will
> be faster for this approach.
> 
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
> ---
>  sky2.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletion(-)
> 
> --- linux-2.6.24.rc5.org/drivers/net/sky2.c	2007-12-12 10:19:43.000000000 +0800
> +++ linux-2.6.24.rc5/drivers/net/sky2.c	2007-12-12 15:23:37.000000000 +0800
> @@ -4270,8 +4270,10 @@ static void __devexit sky2_remove(struct
>  	del_timer_sync(&hw->watchdog_timer);
>  	cancel_work_sync(&hw->restart_work);
>  
> +	rtnl_lock();
>  	for (i = hw->ports-1; i >= 0; --i)
> -		unregister_netdev(hw->dev[i]);
> +		unregister_netdevice(hw->dev[i]);
> +	rtnl_unlock();
>  
>  	sky2_write32(hw, B0_IMSK, 0);
> 

Umm, okay but it doesn't matter really, there can only be 2 ports and
90+% of the boards only have one port.  So why bother??

-- 
Stephen Hemminger <shemminger@linux-foundation.org>

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

* Re: [PATCH 4/4] sky2: rtnl_lock out of loop will be faster
  2007-12-12 16:30 ` Stephen Hemminger
@ 2007-12-13  6:26   ` Wang Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Wang Chen @ 2007-12-13  6:26 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David S. Miller, Jeff Garzik, netdev

Stephen Hemminger said the following on 2007-12-13 0:30:
> Umm, okay but it doesn't matter really, there can only be 2 ports and
> 90+% of the boards only have one port.  So why bother??
> 

Thanks Stephen.
David, please ignore all of the four patches.


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

* Re: [PATCH 4/4] sky2: rtnl_lock out of loop will be faster
  2007-12-12  8:50 [PATCH 4/4] sky2: rtnl_lock out of loop will be faster Wang Chen
  2007-12-12 16:30 ` Stephen Hemminger
@ 2007-12-14 21:17 ` Jeff Garzik
  1 sibling, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2007-12-14 21:17 UTC (permalink / raw)
  To: Wang Chen; +Cc: David S. Miller, shemminger, netdev

Wang Chen wrote:
> [PATCH 4/4] [NETDEV] sky2: rtnl_lock out of loop will be faster
> 
> Before this patch, it gets and releases the lock at each
> iteration of the loop. Changing unregister_netdev to
> unregister_netdevice and locking outside of the loop will
> be faster for this approach.
> 
> Signed-off-by: Wang Chen <wangchen@cn.fujitsu.com>
> ---
>  sky2.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletion(-)
> 
> --- linux-2.6.24.rc5.org/drivers/net/sky2.c	2007-12-12 10:19:43.000000000 +0800
> +++ linux-2.6.24.rc5/drivers/net/sky2.c	2007-12-12 15:23:37.000000000 +0800
> @@ -4270,8 +4270,10 @@ static void __devexit sky2_remove(struct
>  	del_timer_sync(&hw->watchdog_timer);
>  	cancel_work_sync(&hw->restart_work);
>  
> +	rtnl_lock();
>  	for (i = hw->ports-1; i >= 0; --i)
> -		unregister_netdev(hw->dev[i]);
> +		unregister_netdevice(hw->dev[i]);
> +	rtnl_unlock();

while true and correct, I don't see the remove path as needing this type 
of micro-optimization.

Removing and shutting down hardware is an operation that can take many 
seconds (an eternity, to a computer)... a very slow operation.

Thus, given that speed is not a priority here, I place more value on 
smaller, more compact, easily reviewable code -- the existing unpatched 
code in this case.

	Jeff






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

end of thread, other threads:[~2007-12-14 21:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-12  8:50 [PATCH 4/4] sky2: rtnl_lock out of loop will be faster Wang Chen
2007-12-12 16:30 ` Stephen Hemminger
2007-12-13  6:26   ` Wang Chen
2007-12-14 21:17 ` Jeff Garzik

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