[v11,4/4] cpumask: Add assign cpu
Commit Message
Standardize an assign_cpu function for cpumasks.
Signed-off-by: Charlie Jenkins <charlie@rivosinc.com>
---
arch/riscv/mm/cacheflush.c | 2 +-
include/linux/cpumask.h | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
@@ -234,7 +234,7 @@ int riscv_set_icache_flush_ctx(unsigned long ctx, unsigned long scope)
stale_cpu = cpumask_test_cpu(smp_processor_id(), mask);
cpumask_setall(mask);
- assign_bit(cpumask_check(smp_processor_id()), cpumask_bits(mask), stale_cpu);
+ cpumask_assign_cpu(smp_processor_id(), mask, stale_cpu);
break;
case PR_RISCV_SCOPE_PER_THREAD:
current->thread.force_icache_flush = false;
@@ -492,6 +492,22 @@ 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)