lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 14 Dec 2007 16:17:32 -0500
From:	Jeff Garzik <jgarzik@...ox.com>
To:	Wang Chen <wangchen@...fujitsu.com>
CC:	"David S. Miller" <davem@...emloft.net>,
	shemminger@...ux-foundation.org, netdev@...r.kernel.org
Subject: Re: [PATCH 4/4] sky2: rtnl_lock out of loop will be faster

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





--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ