mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pekka Paalanen <pq@iki.fi>
To: mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	rusty@rustcorp.com.au, pq@iki.fi, tglx@linutronix.de,
	mingo@elte.hu
Subject: Re: [tip:cpus4096] x86: cpumask: x86 mmio-mod.c use cpumask_var_t for downed_cpus
Date: Wed, 11 Mar 2009 19:45:51 +0200	[thread overview]
Message-ID: <20090311194551.53ecd866@daedalus.pq.iki.fi> (raw)
In-Reply-To: <tip-f5c14fe200f4315b305ae44e5633cbe62070aaea@git.kernel.org>

On Wed, 11 Mar 2009 11:13:59 GMT
Rusty Russell <rusty@rustcorp.com.au> wrote:

> Commit-ID:  f5c14fe200f4315b305ae44e5633cbe62070aaea
> Gitweb:     http://git.kernel.org/tip/f5c14fe200f4315b305ae44e5633cbe62070aaea
> Author:     "Rusty Russell" <rusty@rustcorp.com.au>
> AuthorDate: Wed, 11 Mar 2009 16:33:55 +1030
> Commit:     Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed, 11 Mar 2009 11:19:47 +0100
> 
> x86: cpumask: x86 mmio-mod.c use cpumask_var_t for downed_cpus
> 
> Impact: cleanup, reduce memory usage for CONFIG_CPUMASK_OFFSTACK=y
> 
> Part of the "getting rid of obsolete cpumask_t" patch:
> 
>  1) Use cpumask_var_t: this is a pointer if CONFIG_CPUMASK_OFFSTACK=y
>  2) Call alloc_cpumask_var() on first entry into enter_uniprocessor()
>  3) Use modern cpumask_* functions.
> 
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Pekka Paalanen <pq@iki.fi>
> LKML-Reference: <200903111633.55952.rusty@rustcorp.com.au>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>

Acked-by: Pekka Paalanen <pq@iki.fi>

> 
> 
> ---
>  arch/x86/mm/mmio-mod.c |   19 +++++++++++++------
>  1 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> index 2c4baa8..c9342ed 100644
> --- a/arch/x86/mm/mmio-mod.c
> +++ b/arch/x86/mm/mmio-mod.c
> @@ -378,27 +378,34 @@ static void clear_trace_list(void)
>  }
>  
>  #ifdef CONFIG_HOTPLUG_CPU
> -static cpumask_t downed_cpus;
> +static cpumask_var_t downed_cpus;
>  
>  static void enter_uniprocessor(void)
>  {
>  	int cpu;
>  	int err;
>  
> +	if (downed_cpus == NULL &&
> +	    !alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
> +		pr_notice(NAME "Failed to allocate mask\n");
> +		goto out;
> +	}
> +
>  	get_online_cpus();
> -	downed_cpus = cpu_online_map;
> -	cpu_clear(first_cpu(cpu_online_map), downed_cpus);
> +	cpumask_copy(downed_cpus, cpu_online_mask);
> +	cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
>  	if (num_online_cpus() > 1)
>  		pr_notice(NAME "Disabling non-boot CPUs...\n");
>  	put_online_cpus();
>  
> -	for_each_cpu_mask(cpu, downed_cpus) {
> +	for_each_cpu(cpu, downed_cpus) {
>  		err = cpu_down(cpu);
>  		if (!err)
>  			pr_info(NAME "CPU%d is down.\n", cpu);
>  		else
>  			pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err);
>  	}
> +out:
>  	if (num_online_cpus() > 1)
>  		pr_warning(NAME "multiple CPUs still online, "
>  						"may miss events.\n");
> @@ -411,10 +418,10 @@ static void __ref leave_uniprocessor(void)
>  	int cpu;
>  	int err;
>  
> -	if (cpus_weight(downed_cpus) == 0)
> +	if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
>  		return;
>  	pr_notice(NAME "Re-enabling CPUs...\n");
> -	for_each_cpu_mask(cpu, downed_cpus) {
> +	for_each_cpu(cpu, downed_cpus) {
>  		err = cpu_up(cpu);
>  		if (!err)
>  			pr_info(NAME "enabled CPU%d.\n", cpu);
> 


-- 
Pekka Paalanen
http://www.iki.fi/pq/

  reply	other threads:[~2009-03-11 17:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-11  6:03 [PATCH] " Rusty Russell
2009-03-11 11:13 ` [tip:cpus4096] x86: " Rusty Russell
2009-03-11 17:45   ` Pekka Paalanen [this message]
2009-03-18 12:58 ` Rusty Russell

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=20090311194551.53ecd866@daedalus.pq.iki.fi \
    --to=pq@iki.fi \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=rusty@rustcorp.com.au \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®