Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}
From: Michał Mirosław
Date: Sat Nov 27 2021 - 23:58:58 EST
- Next message: Michał Mirosław: "Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}"
- Previous message: kernel test robot: "arch/mips/mm/tlbex.c:2599 check_pabits() warn: always true condition '(fillbits >= ((__builtin_constant_p(0)) ?(((0) < 2) ?0:63 - __builtin_clzll(0)):((4 <= 4)) ?__ilog2_u32(0):__ilog2_u64(0))) => (0-u32max >= 0)'"
- In reply to: Yury Norov: "[PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}"
- Next in thread: Michał Mirosław: "Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Nov 27, 2021 at 07:57:02PM -0800, Yury Norov wrote:
> Add num_{possible,present,active}_cpus_{eq,gt,le} and replace num_*_cpus()
> with one of new functions where appropriate. This allows num_*_cpus_*()
> to return earlier depending on the condition.
[...]
> @@ -3193,7 +3193,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size,
>
> /* allocate pages */
> j = 0;
> - for (unit = 0; unit < num_possible_cpus(); unit++) {
> + for (unit = 0; num_possible_cpus_gt(unit); unit++) {
This looks dubious. The old version I could hope the compiler would call
num_possible_cpus() only once if it's marked const or pure, but the
alternative is going to count the bits every time making this a guaranteed
O(n^2) even though the bitmap doesn't change.
Best Regards
Michał Mirosław
- Next message: Michał Mirosław: "Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}"
- Previous message: kernel test robot: "arch/mips/mm/tlbex.c:2599 check_pabits() warn: always true condition '(fillbits >= ((__builtin_constant_p(0)) ?(((0) < 2) ?0:63 - __builtin_clzll(0)):((4 <= 4)) ?__ilog2_u32(0):__ilog2_u64(0))) => (0-u32max >= 0)'"
- In reply to: Yury Norov: "[PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}"
- Next in thread: Michał Mirosław: "Re: [PATCH 7/9] lib/cpumask: add num_{possible,present,active}_cpus_{eq,gt,le}"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]