linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@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 v2] mm/vmstat: Avoid on each online CPU loops
Date: Tue, 29 Nov 2016 16:20:12 +0100	[thread overview]
Message-ID: <20161129152012.GB9796@dhcp22.suse.cz> (raw)
In-Reply-To: <20161129145113.fn3lw5aazjjvdrr3@linutronix.de>

On Tue 29-11-16 15:51:14, Sebastian Andrzej Siewior wrote:
> Both iterations over online cpus can be replaced by the proper node
> specific functions.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Cc: Mel Gorman <mgorman@techsingularity.net>
> Cc: Johannes Weiner <hannes@cmpxchg.org>
> Cc: linux-mm@kvack.org
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
> v1a?|v2: take into account that we may have online nodes with no CPUs.
> 
>  mm/vmstat.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index 0b63ffb5c407..5152cd1c490f 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1720,19 +1720,21 @@ static void __init start_shepherd_timer(void)
>  
>  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) {
> +		if (cpumask_weight(cpumask_of_node(node)) > 0)
> +			node_set_state(node, N_CPU);
> +	}
>  }
>  
>  static void vmstat_cpu_dead(int node)
>  {
> -	int cpu;
> +	const struct cpumask *node_cpus;
>  
> -	for_each_online_cpu(cpu)
> -		if (cpu_to_node(cpu) == node)
> -			return;
> +	node_cpus = cpumask_of_node(node);
> +	if (cpumask_weight(node_cpus) > 0)
> +		return;
>  
>  	node_clear_state(node, N_CPU);
>  }
> -- 
> 2.10.2

-- 
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	other threads:[~2016-11-29 15:20 UTC|newest]

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
2016-11-29 14:51       ` [PATCH 08/22 v2] " Sebastian Andrzej Siewior
2016-11-29 15:20         ` Michal Hocko [this message]
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=20161129152012.GB9796@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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).