mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-16 01:54:00 +00:00
cpumask: introduce assign_cpu() macro
Now that assign_bit() is a thin macro wrapper around set_bit() and clear_bit(), we can use it in cpumask API and drop duplicating implementations of set_cpu_xxx() helpers with no additional overhead. Bloat-o-meter reports almost 2k less of generated code for allyesconfig, mostly in kernel/cpu.c: add/remove: 2/4 grow/shrink: 3/4 up/down: 498/-2228 (-1730) Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: Yury Norov <yury.norov@gmail.com>
This commit is contained in:
parent
46d1907d1c
commit
5c563ee90a
@ -1083,44 +1083,16 @@ void init_cpu_present(const struct cpumask *src);
|
||||
void init_cpu_possible(const struct cpumask *src);
|
||||
void init_cpu_online(const struct cpumask *src);
|
||||
|
||||
static inline void
|
||||
set_cpu_possible(unsigned int cpu, bool possible)
|
||||
{
|
||||
if (possible)
|
||||
cpumask_set_cpu(cpu, &__cpu_possible_mask);
|
||||
else
|
||||
cpumask_clear_cpu(cpu, &__cpu_possible_mask);
|
||||
}
|
||||
#define assign_cpu(cpu, mask, val) \
|
||||
assign_bit(cpumask_check(cpu), cpumask_bits(mask), (val))
|
||||
|
||||
static inline void
|
||||
set_cpu_present(unsigned int cpu, bool present)
|
||||
{
|
||||
if (present)
|
||||
cpumask_set_cpu(cpu, &__cpu_present_mask);
|
||||
else
|
||||
cpumask_clear_cpu(cpu, &__cpu_present_mask);
|
||||
}
|
||||
#define set_cpu_possible(cpu, possible) assign_cpu((cpu), &__cpu_possible_mask, (possible))
|
||||
#define set_cpu_present(cpu, present) assign_cpu((cpu), &__cpu_present_mask, (present))
|
||||
#define set_cpu_active(cpu, active) assign_cpu((cpu), &__cpu_active_mask, (active))
|
||||
#define set_cpu_dying(cpu, dying) assign_cpu((cpu), &__cpu_dying_mask, (dying))
|
||||
|
||||
void set_cpu_online(unsigned int cpu, bool online);
|
||||
|
||||
static inline void
|
||||
set_cpu_active(unsigned int cpu, bool active)
|
||||
{
|
||||
if (active)
|
||||
cpumask_set_cpu(cpu, &__cpu_active_mask);
|
||||
else
|
||||
cpumask_clear_cpu(cpu, &__cpu_active_mask);
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_cpu_dying(unsigned int cpu, bool dying)
|
||||
{
|
||||
if (dying)
|
||||
cpumask_set_cpu(cpu, &__cpu_dying_mask);
|
||||
else
|
||||
cpumask_clear_cpu(cpu, &__cpu_dying_mask);
|
||||
}
|
||||
|
||||
/**
|
||||
* to_cpumask - convert a NR_CPUS bitmap to a struct cpumask *
|
||||
* @bitmap: the bitmap
|
||||
|
Loading…
x
Reference in New Issue
Block a user