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: <5212E7BB.4020602@asianux.com>
Date:	Tue, 20 Aug 2013 11:51:23 +0800
From:	Chen Gang <gang.chen@...anux.com>
To:	dipankar@...ibm.com, Paul McKenney <paulmck@...ux.vnet.ibm.com>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/rcutree.c: deem to be lazy if there are no callbacks.



If 'hc' is false, 'al' will never be false, either (only need check
"irdp->qlen != rdp->qlen_lazy' when 'rdp->nxtlist' existance).

Recommend to improve the related code, like the diff below.

----------------------------------diff begin------------------------------------

diff --git a/kernel/rcutree.c b/kernel/rcutree.c
index 5b53a89..421caf0 100644
--- a/kernel/rcutree.c
+++ b/kernel/rcutree.c
@@ -2719,10 +2719,13 @@ static int rcd'_cpu_has_callbacks(int cpu, bool *all_lazy)
 
 	for_each_rcu_flavor(rsp) {
 		rdp = per_cpu_ptr(rsp->rda, cpu);
-		if (rdp->qlen != rdp->qlen_lazy)
-			al = false;
-		if (rdp->nxtlist)
+		if (rdp->nxtlist) {
 			hc = true;
+			if (rdp->qlen != rdp->qlen_lazy) {
+				al = false;
+				break;
+			}
+		}
 	}
 	if (all_lazy)
 		*all_lazy = al;

----------------------------------diff end--------------------------------------


On 08/20/2013 11:50 AM, Chen Gang wrote:
> According to the comment above rcu_cpu_has_callbacks(): "If there are
> no callbacks, all of them are deemed to be lazy".
> 
> So when both 'hc' and 'al' are false, '*all_lazy' should be true, not
> false.
> 
> 
> Signed-off-by: Chen Gang <gang.chen@...anux.com>
> ---
>  kernel/rcutree.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/kernel/rcutree.c b/kernel/rcutree.c
> index 5b53a89..9ee9565 100644
> --- a/kernel/rcutree.c
> +++ b/kernel/rcutree.c
> @@ -2725,7 +2725,7 @@ static int rcu_cpu_has_callbacks(int cpu, bool *all_lazy)
>  			hc = true;
>  	}
>  	if (all_lazy)
> -		*all_lazy = al;
> +		*all_lazy = !hc ? true : al;
>  	return hc;
>  }
>  
> 


-- 
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ