[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH for-6.2 v2 04/11] machine: Use the computed parameters to cal
|
From: |
Andrew Jones |
|
Subject: |
Re: [PATCH for-6.2 v2 04/11] machine: Use the computed parameters to calculate omitted cpus |
|
Date: |
Thu, 22 Jul 2021 17:05:05 +0200 |
On Thu, Jul 22, 2021 at 10:59:11PM +0800, wangyanan (Y) wrote:
> Ok. If we remove the rounding, then the calculation code has to be modified
> to be like the following. We have to separately consider the case that cpus
> and maxcpus are both omitted (e.g. -smp sockets=16).
>
> maxcpus = maxcpus > 0 ? maxcpus : cpus;
>
> if (cpus == 0 && maxcpus == 0) {
> sockets = sockets > 0 ? sockets : 1;
> cores = cores > 0 ? cores : 1;
> threads = threads > 0 ? threads : 1;
> goto cal;
> }
>
> if (sockets == 0) {
> ...
> } else if (cores == 0) {
> ...
> } else if (threads == 0) {
> ...
> }
>
> cal:
> maxcpus = maxcpus > 0 ? maxcpus : sockets * cores * threads;
> cpus = cpus > 0 ? cpus : maxcpus;
Whatever works, but hopefully you can avoid an ugly goto.
Thanks,
drew
- [PATCH for-6.2 v2 06/11] hw: Add compat machines for 6.2, (continued)
[PATCH for-6.2 v2 07/11] machine: Prefer cores over sockets in smp parsing since 6.2, Yanan Wang, 2021/07/18
[PATCH for-6.2 v2 02/11] machine: Make smp_parse generic enough for all arches, Yanan Wang, 2021/07/18