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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20140213.174606.334208738068503053.davem@davemloft.net>
Date:	Thu, 13 Feb 2014 17:46:06 -0500 (EST)
From:	David Miller <davem@...emloft.net>
To:	yangyingliang@...wei.com
Cc:	netdev@...r.kernel.org, stephen@...workplumber.org
Subject: Re: [PATCH net-next 4/4] sch_netem: replace spin_(un)lock_bh with
 sch_tree_(un)lock

From: Yang Yingliang <yangyingliang@...wei.com>
Date: Wed, 12 Feb 2014 10:58:15 +0800

> spin_(un)lock_bh(root_lock) is same as sch_tree_(un)lock.
> 
> Signed-off-by: Yang Yingliang <yangyingliang@...wei.com>
 ...
> @@ -684,11 +683,9 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr)
>  	for (i = 0; i < n; i++)
>  		d->table[i] = data[i];
>  
> -	root_lock = qdisc_root_sleeping_lock(sch);
> -
> -	spin_lock_bh(root_lock);
> +	sch_tree_lock(sch);
>  	swap(q->delay_dist, d);
> -	spin_unlock_bh(root_lock);
> +	sch_tree_unlock(sch);
>  
>  	dist_free(d);
>  	return 0;

This is more expensive than the existing code.

We will now calculate qdisc_root_sleeping_lock() twice which is at
least two pointer dereferences each.

Without explicitly open-coding this, the compiler cannot cache the
result, because the spin lock operations have memory barriers (if
implemented inline) or are considered to potentially modify all memory
(if implemented as function calls).
--
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