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]
Date:   Tue, 29 Nov 2016 15:44:37 +0100
From:   Michal Hocko <mhocko@...nel.org>
To:     Thomas Gleixner <tglx@...utronix.de>
Cc:     Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
        linux-kernel@...r.kernel.org, rt@...utronix.de,
        Andrew Morton <akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        Mel Gorman <mgorman@...hsingularity.net>,
        Johannes Weiner <hannes@...xchg.org>, linux-mm@...ck.org
Subject: Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops

On Tue 29-11-16 15:08:10, Thomas Gleixner wrote:
> On Mon, 28 Nov 2016, Michal Hocko wrote:
> > On Sun 27-11-16 00:13:36, Sebastian Andrzej Siewior wrote:
> > [...]
> > >  static void __init init_cpu_node_state(void)
> > >  {
> > > -	int cpu;
> > > +	int node;
> > >  
> > > -	for_each_online_cpu(cpu)
> > > -		node_set_state(cpu_to_node(cpu), N_CPU);
> > > +	for_each_online_node(node)
> > > +		node_set_state(node, N_CPU);
> > 
> > Is this really correct? The point of the original code was to mark only
> > those nodes which have at least one CPU. Or am I missing something?
> 
> You're right. An online node does not necessarily have an online CPU.
> 
> 	for_each_online_node(node) {
> 		if (cpumask_weight(cpumask_of_node(node)) > 0)
> 			node_set_state(node, N_CPU);
> 	}
> 
> is probably more correct.

Yes, this looks correct. Considering that the same cpumask_weight is
used in another function I guess a small helper would be nice. E.g.
bool node_has_cpus(int node)
{
	return cpumask_weight(cpumask_of_node(node)) > 0;
}

-- 
Michal Hocko
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ