Linux-mm Archive on lore.kernel.org
 help / color / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	linux-kernel@vger.kernel.org, rt@linutronix.de,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>,
	Mel Gorman <mgorman@techsingularity.net>,
	Johannes Weiner <hannes@cmpxchg.org>,
	linux-mm@kvack.org
Subject: Re: [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops
Date: Tue, 29 Nov 2016 15:44:37 +0100
Message-ID: <20161129144437.GA9796@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.20.1611291505340.4358@nanos>

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

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply index

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20161126231350.10321-1-bigeasy@linutronix.de>
2016-11-26 23:13 ` [PATCH 07/22] mm/vmstat: Drop get_online_cpus() from init_cpu_node_state/vmstat_cpu_dead() Sebastian Andrzej Siewior
2016-11-28  9:24   ` Michal Hocko
2016-11-26 23:13 ` [PATCH 08/22] mm/vmstat: Avoid on each online CPU loops Sebastian Andrzej Siewior
2016-11-28  9:28   ` Michal Hocko
2016-11-29 14:08     ` Thomas Gleixner
2016-11-29 14:44       ` Michal Hocko [this message]
2016-11-29 14:51       ` [PATCH 08/22 v2] " Sebastian Andrzej Siewior
2016-11-29 15:20         ` Michal Hocko
2016-11-26 23:13 ` [PATCH 09/22] mm/vmstat: Convert to hotplug state machine Sebastian Andrzej Siewior
2016-11-29 14:52   ` [PATCH 09/22 v2] " Sebastian Andrzej Siewior
2016-11-26 23:13 ` [PATCH 10/22] mm/zsmalloc: " Sebastian Andrzej Siewior
2016-11-26 23:13 ` [PATCH 11/22] mm/zswap: Convert dst-mem " Sebastian Andrzej Siewior
2016-11-26 23:13 ` [PATCH 12/22] mm/zswap: Convert pool " Sebastian Andrzej Siewior
2016-11-26 23:13 ` [PATCH 14/22] mm/compaction: Convert " Sebastian Andrzej Siewior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161129144437.GA9796@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=bigeasy@linutronix.de \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@techsingularity.net \
    --cc=rt@linutronix.de \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-mm Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-mm/0 linux-mm/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-mm linux-mm/ https://lore.kernel.org/linux-mm \
		linux-mm@kvack.org
	public-inbox-index linux-mm

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kvack.linux-mm


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git