All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gautham R Shenoy <ego@in.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Ashok Raj <ashok.raj@intel.com>
Subject: Re: [PATCH 14/14] cpumask: don't recommend set_cpus_allowed hack in Documentation/cpu-hotplug.txt
Date: Tue, 3 Nov 2009 11:27:23 +0530	[thread overview]
Message-ID: <20091103055723.GA19322@in.ibm.com> (raw)
In-Reply-To: <200911031459.06857.rusty@rustcorp.com.au>

Hi Rusty,

On Tue, Nov 03, 2009 at 02:59:06PM +1030, Rusty Russell wrote:
> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Gautham R Shenoy <ego@in.ibm.com>
> Cc: Ashok Raj <ashok.raj@intel.com>
> ---
>  Documentation/cpu-hotplug.txt |   49 ++++++++++++++----------------------------
>  1 file changed, 17 insertions(+), 32 deletions(-)
> 
> diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
> --- a/Documentation/cpu-hotplug.txt
> +++ b/Documentation/cpu-hotplug.txt
> @@ -309,41 +309,26 @@ A: The following are what is required fo
> 
>  Q: I need to ensure that a particular cpu is not removed when there is some
>     work specific to this cpu is in progress.
> -A: First switch the current thread context to preferred cpu
> +A: There are two ways.  If your code can be run in interrupt context, use
> +   smp_call_function_single(), otherwise use work_on_cpu().  Note that
> +   work_on_cpu() can fail due to out of memory:
> 
>  	int my_func_on_cpu(int cpu)
>  	{
> +		int err;
> +		cpu_hotplug_lock();
		^^^^^^^^^^^^^^^^^^^
This needs to be get_online_cpus();
> +		if (!cpu_online(cpu))
> +			err = -EINVAL;
> +		else
> +#if NEEDS_BLOCKING
> +			err = work_on_cpu(cpu, __my_func_on_cpu, NULL);
> +#else
> +			smp_call_function_single(cpu, __my_func_on_cpu, &err,
> +						 true);
> +#endif
> +		cpu_hotplug_unlock();
		^^^^^^^^^^^^^^^^^^^^^
And this one should be put_online_cpus();

> +		return err;
> +	}
> 
>  Q: How do we determine how many CPUs are available for hotplug.
>  A: There is no clear spec defined way from ACPI that can give us that

-- 
Thanks and Regards
gautham

  reply	other threads:[~2009-11-03  5:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-03  4:29 [PATCH 14/14] cpumask: don't recommend set_cpus_allowed hack in Documentation/cpu-hotplug.txt Rusty Russell
2009-11-03  5:57 ` Gautham R Shenoy [this message]
2009-11-04  8:02   ` 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=20091103055723.GA19322@in.ibm.com \
    --to=ego@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=ashok.raj@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.