lkml.org 
[lkml]   [2018]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [RFC PATCH] ACPI / processor: Get accurate possible CPU count
From
Date
Hi Andy,

At 03/15/2018 01:24 AM, Andy Shevchenko wrote:
> On Wed, Mar 14, 2018 at 12:28 PM, Dou Liyang <douly.fnst@cn.fujitsu.com> 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:
>

Yes, I agree, It's smarter and clearer. Will use it.

Thanks,
dou

> 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);
>> +}
>


\
 
 \ /
  Last update: 2018-03-15 04:02    [W:0.114 / U:5.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site