Re: [RFC PATCH] ACPI / processor: Get accurate possible CPU count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 14, 2018 at 12:28 PM, Dou Liyang <douly.fnst@xxxxxxxxxxxxxx> wrote:

> +static void __init acpi_update_possible_map(void)
> +{
> +       unsigned int cpu, nr = 0;
> +

> +       if (nr_cpu_ids <= nr_unique_ids)
> +               return;
> +
> +       for_each_possible_cpu(cpu) {
> +               if (nr >= nr_unique_ids)
> +                       set_cpu_possible(cpu, false);
> +               nr++;
> +       }

IIUC this can be optimized to:

if (nr_unique_ids >= nr_cpu_ids)
    return;

/* Don't yet figure out if it's superfluous */
if (nr_unique_ids >= cpumask_last(cpu_possible_mask))
    return;

for_each_cpu_wrap(cpu, cpu_possible_mask, nr_unique_ids)
    set_cpu_possible(cpu, false);

> +       nr_cpu_ids = nr_unique_ids;
> +       pr_info("Allowing %d possible CPUs\n", nr_cpu_ids);
> +}

-- 
With Best Regards,
Andy Shevchenko
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux