cleanup dead code in nodemasks and cpumasks
Subsystems (2)
Yury Norov
maintainercover cleanup dead code in nodemasks and cpumasks
Cleanup dead code in nodemasks and cpumasks, and while there, fix set_icache_stale_mask() that misuses atomic cpumask_assign_cpu().
Yury Norov (4):
nodemask: drop nodes_shift
cpumask: add non-atomic __assign_cpu()
riscv: switch set_icache_stale_mask() to using non-atomic assign_cpu()
cpumask: drop cpumask_assign_cpu()
arch/riscv/mm/cacheflush.c | 2 +- include/linux/cpumask.h | 19 +++---------------- include/linux/nodemask.h | 19 ------------------- 3 files changed, 4 insertions(+), 36 deletions(-)
Signature · 1 line
2.43.0
Yury Norov
maintainerPATCH 1/4 nodemask: drop nodes_shift
nodes_shift_{left,right} are not used. Drop them.
--- include/linux/nodemask.h | 19 ------------------- 1 file changed, 19 deletions(-)
include/linux/nodemask.h +0 -19
@@ -39,9 +39,6 @@* int nodes_full(mask) Is mask full (all bits sets)? * int nodes_weight(mask) Hamming weight - number of set bits * -* void nodes_shift_right(dst, src, n) Shift right -* void nodes_shift_left(dst, src, n) Shift left -* * unsigned int first_node(mask) Number lowest set bit, or MAX_NUMNODES * unsigend int next_node(node, mask) Next node past 'node', or MAX_NUMNODES * unsigned int next_node_in(node, mask) Next node past 'node', or wrap to first,
@@ -241,22 +238,6 @@ static __always_inline int __nodes_weight(const nodemask_t *srcp, unsigned int nreturn bitmap_weight (srcp->bits, nbits); } -#define nodes_shift_right (dst, src, n) \ - __nodes_shift_right(&(dst), &(src), (n), MAX_NUMNODES) -static __always_inline void __nodes_shift_right(nodemask_t *dstp, -const nodemask_t *srcp,int n,int nbits) -{ -bitmap_shift_right (dstp->bits, srcp->bits, n, nbits); -} - -#define nodes_shift_left (dst, src, n) \ - __nodes_shift_left(&(dst), &(src), (n), MAX_NUMNODES) -static __always_inline void __nodes_shift_left(nodemask_t *dstp, -const nodemask_t *srcp,int n,int nbits) -{ -bitmap_shift_left (dstp->bits, srcp->bits, n, nbits); -} -/* FIXME: better would be to fix all architectures to never return > MAX_NUMNODES, then the silly min_ts could be dropped. */
Signature · 1 line
2.43.0
Yury Norov
maintainerPATCH 2/4 cpumask: add non-atomic __assign_cpu()
In reply to Yury NorovSimilarly to atomic, add a non-atomic version.
--- include/linux/cpumask.h | 3 +++ 1 file changed, 3 insertions(+)
include/linux/cpumask.h +3 -0
@@ -1074,6 +1074,9 @@ void init_cpu_possible(const struct cpumask *src);#define assign_cpu (cpu, mask, val) \ assign_bit(cpumask_check(cpu), cpumask_bits(mask), (val)) +#define __assign_cpu (cpu, mask, val) \ + __assign_bit(cpumask_check(cpu), cpumask_bits(mask), (val)) +#define set_cpu_possible (cpu, possible) assign_cpu((cpu), &__cpu_possible_mask, (possible))#define set_cpu_enabled (cpu, enabled) assign_cpu((cpu), &__cpu_enabled_mask, (enabled))#define set_cpu_present (cpu, present) assign_cpu((cpu), &__cpu_present_mask, (present))
Signature · 1 line
2.43.0
Yury Norov
maintainerPATCH 3/4 riscv: switch set_icache_stale_mask() to using non-atomic assign_cpu()
In reply to Yury NorovThe atomic cpumask_assign_cpu() follows non-atomic cpumask_setall(), which makes the whole operation non-atomic. Fix this by relaxing to non-atomic __assign_cpu().
--- arch/riscv/mm/cacheflush.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/cacheflush.c +1 -1
@@ -172,7 +172,7 @@ static void set_icache_stale_mask(void) stale_cpu =cpumask_test_cpu (cpu, mask);cpumask_setall (mask); -cpumask_assign_cpu (cpu, mask, stale_cpu); +__assign_cpu (cpu, mask, stale_cpu); put_cpu(); }#endif
Signature · 1 line
2.43.0
Yury Norov
maintainerPATCH 4/4 cpumask: drop cpumask_assign_cpu()
In reply to Yury NorovCommit decde1fa209323c7 ("cpumask: Add assign cpu") was merged bypassing cpumasks reviewers. It adds atomic and non-atomic cpumask_assign_cpu() helpers.
In the same merge window, commit 5c563ee90a22d3 ("cpumask: introduce assign_cpu() macro") added the same functionality. So now we have it duplicated.
__cpumask_assign_cpu() has never been used since introducing, and because this series reworks the only user of cpumask_assign_cpu(), both functions become a dead code.
--- include/linux/cpumask.h | 16 ---------------- 1 file changed, 16 deletions(-)
include/linux/cpumask.h +0 -16
@@ -558,22 +558,6 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp)__clear_bit (cpumask_check (cpu),cpumask_bits (dstp)); } -/** -* cpumask_assign_cpu - assign a cpu in a cpumask -* @cpu: cpu number (< nr_cpu_ids) -* @dstp: the cpumask pointer -* @bool: the value to assign -*/ -static __always_inline void cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value) -{ -assign_bit (cpumask_check (cpu),cpumask_bits (dstp), value); -} - -static __always_inline void __cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value) -{ -__assign_bit (cpumask_check (cpu),cpumask_bits (dstp), value); -} -/** * cpumask_test_cpu - test for a cpu in a cpumask * @cpu: cpu number (< nr_cpu_ids)
Signature · 1 line
2.43.0
Yury Norov
maintainerPing?
If no objections, I'll schedule it for 6.15.
Quoted 16 lines · Yury Norov
Cleanup dead code in nodemasks and cpumasks, and while there, fix
set_icache_stale_mask()that misuses atomiccpumask_assign_cpu().Yury Norov (4):
nodemask: dropnodes_shift
cpumask: add non-atomic__assign_cpu()
riscv: switchset_icache_stale_mask()to using non-atomicassign_cpu()
cpumask: dropcpumask_assign_cpu()arch/riscv/mm/cacheflush.c | 2 +- include/linux/cpumask.h | 19 +++---------------- include/linux/nodemask.h | 19 ------------------- 3 files changed, 4 insertions(+), 36 deletions(-)Signature · 1 line
2.43.0