lkml.org 
[lkml]   [2013]   [Jun]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: cpu hotplug: possible_cpus broken (again?) next-20130607
On 06/12/2013 05:03 AM, Youquan Song wrote:
> +#ifdef CONFIG_SMP
> + /* return when cpu number greater than maximum number of
> CPUs */
> + if (setup_max_cpus <= num_online_cpus() + 1) {
> + cpu_hotplug_driver_unlock();
> + return -EINVAL;
> + }
> +#endif
> from_nid = cpu_to_node(cpuid);
> ret = cpu_up(cpuid);

Your patch is line-wrapped.

Also, the #ifdef is unnecessary. If CONFIG_SMP is off:

static const unsigned int setup_max_cpus = NR_CPUS;
#define num_online_cpus() 1U

The compiler will take care of optimizing out the the if() without the
explicit #ifdef.

Also, the +1 looks goofy to me. Doesn't this do the same thing (and
isn't it much easier to read)?

if (num_online_cpus() >= setup_max_cpus)


\
 
 \ /
  Last update: 2013-06-12 02:41    [W:0.122 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site