Loading arch/arm/kernel/irq.c +10 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include <linux/kallsyms.h> #include <linux/proc_fs.h> #include <linux/export.h> #include <linux/cpumask.h> #include <asm/hardware/cache-l2x0.h> #include <asm/hardware/cache-uniphier.h> Loading Loading @@ -127,6 +128,7 @@ static bool migrate_one_irq(struct irq_desc *desc) const struct cpumask *affinity = irq_data_get_affinity_mask(d); struct irq_chip *c; bool ret = false; struct cpumask available_cpus; /* * If this is a per-CPU interrupt, or the affinity does not Loading @@ -135,7 +137,14 @@ static bool migrate_one_irq(struct irq_desc *desc) if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) return false; cpumask_copy(&available_cpus, affinity); cpumask_andnot(&available_cpus, &available_cpus, cpu_isolated_mask); affinity = &available_cpus; if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { cpumask_andnot(&available_cpus, cpu_online_mask, cpu_isolated_mask); if (cpumask_empty(affinity)) affinity = cpu_online_mask; ret = true; } Loading drivers/base/cpu.c +34 −0 Original line number Diff line number Diff line Loading @@ -181,9 +181,40 @@ static struct attribute_group crash_note_cpu_attr_group = { }; #endif #ifdef CONFIG_HOTPLUG_CPU static ssize_t isolate_show(struct device *dev, struct device_attribute *attr, char *buf) { struct cpu *cpu = container_of(dev, struct cpu, dev); ssize_t rc; int cpuid = cpu->dev.id; unsigned int isolated = cpu_isolated(cpuid); rc = snprintf(buf, PAGE_SIZE-2, "%d\n", isolated); return rc; } static DEVICE_ATTR_RO(isolate); static struct attribute *cpu_isolated_attrs[] = { &dev_attr_isolate.attr, NULL }; static struct attribute_group cpu_isolated_attr_group = { .attrs = cpu_isolated_attrs, }; #endif static const struct attribute_group *common_cpu_attr_groups[] = { #ifdef CONFIG_KEXEC &crash_note_cpu_attr_group, #endif #ifdef CONFIG_HOTPLUG_CPU &cpu_isolated_attr_group, #endif NULL }; Loading @@ -191,6 +222,9 @@ static const struct attribute_group *common_cpu_attr_groups[] = { static const struct attribute_group *hotplugable_cpu_attr_groups[] = { #ifdef CONFIG_KEXEC &crash_note_cpu_attr_group, #endif #ifdef CONFIG_HOTPLUG_CPU &cpu_isolated_attr_group, #endif NULL }; Loading include/linux/cpumask.h +8 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,13 @@ extern struct cpumask __cpu_isolated_mask; #define num_present_cpus() cpumask_weight(cpu_present_mask) #define num_active_cpus() cpumask_weight(cpu_active_mask) #define num_isolated_cpus() cpumask_weight(cpu_isolated_mask) #define num_online_uniso_cpus() \ ({ \ cpumask_t mask; \ \ cpumask_andnot(&mask, cpu_online_mask, cpu_isolated_mask); \ cpumask_weight(&mask); \ }) #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) Loading @@ -115,6 +122,7 @@ extern struct cpumask __cpu_isolated_mask; #define num_present_cpus() 1U #define num_active_cpus() 1U #define num_isolated_cpus() 0U #define num_online_uniso_cpus() 1U #define cpu_online(cpu) ((cpu) == 0) #define cpu_possible(cpu) ((cpu) == 0) #define cpu_present(cpu) ((cpu) == 0) Loading include/linux/sched.h +35 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,41 @@ enum migrate_types { extern cpumask_var_t cpu_isolated_map; #ifdef CONFIG_HOTPLUG_CPU extern int sched_isolate_count(const cpumask_t *mask, bool include_offline); extern int sched_isolate_cpu(int cpu); extern int sched_unisolate_cpu(int cpu); extern int sched_unisolate_cpu_unlocked(int cpu); #else static inline int sched_isolate_count(const cpumask_t *mask, bool include_offline) { cpumask_t count_mask; if (include_offline) cpumask_andnot(&count_mask, mask, cpu_online_mask); else return 0; return cpumask_weight(&count_mask); } static inline int sched_isolate_cpu(int cpu) { return 0; } static inline int sched_unisolate_cpu(int cpu) { return 0; } static inline int sched_unisolate_cpu_unlocked(int cpu) { return 0; } #endif extern void scheduler_tick(void); #define MAX_SCHEDULE_TIMEOUT LONG_MAX Loading include/linux/tick.h +10 −2 Original line number Diff line number Diff line Loading @@ -239,7 +239,15 @@ extern void __tick_nohz_task_switch(void); #else static inline int housekeeping_any_cpu(void) { return smp_processor_id(); cpumask_t available; int cpu; cpumask_andnot(&available, cpu_online_mask, cpu_isolated_mask); cpu = cpumask_any(&available); if (cpu >= nr_cpu_ids) cpu = smp_processor_id(); return cpu; } static inline bool tick_nohz_full_enabled(void) { return false; } static inline bool tick_nohz_full_cpu(int cpu) { return false; } Loading Loading @@ -277,7 +285,7 @@ static inline bool is_housekeeping_cpu(int cpu) if (tick_nohz_full_enabled()) return cpumask_test_cpu(cpu, housekeeping_mask); #endif return true; return !cpu_isolated(cpu); } static inline void housekeeping_affine(struct task_struct *t) Loading Loading
arch/arm/kernel/irq.c +10 −1 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ #include <linux/kallsyms.h> #include <linux/proc_fs.h> #include <linux/export.h> #include <linux/cpumask.h> #include <asm/hardware/cache-l2x0.h> #include <asm/hardware/cache-uniphier.h> Loading Loading @@ -127,6 +128,7 @@ static bool migrate_one_irq(struct irq_desc *desc) const struct cpumask *affinity = irq_data_get_affinity_mask(d); struct irq_chip *c; bool ret = false; struct cpumask available_cpus; /* * If this is a per-CPU interrupt, or the affinity does not Loading @@ -135,7 +137,14 @@ static bool migrate_one_irq(struct irq_desc *desc) if (irqd_is_per_cpu(d) || !cpumask_test_cpu(smp_processor_id(), affinity)) return false; cpumask_copy(&available_cpus, affinity); cpumask_andnot(&available_cpus, &available_cpus, cpu_isolated_mask); affinity = &available_cpus; if (cpumask_any_and(affinity, cpu_online_mask) >= nr_cpu_ids) { cpumask_andnot(&available_cpus, cpu_online_mask, cpu_isolated_mask); if (cpumask_empty(affinity)) affinity = cpu_online_mask; ret = true; } Loading
drivers/base/cpu.c +34 −0 Original line number Diff line number Diff line Loading @@ -181,9 +181,40 @@ static struct attribute_group crash_note_cpu_attr_group = { }; #endif #ifdef CONFIG_HOTPLUG_CPU static ssize_t isolate_show(struct device *dev, struct device_attribute *attr, char *buf) { struct cpu *cpu = container_of(dev, struct cpu, dev); ssize_t rc; int cpuid = cpu->dev.id; unsigned int isolated = cpu_isolated(cpuid); rc = snprintf(buf, PAGE_SIZE-2, "%d\n", isolated); return rc; } static DEVICE_ATTR_RO(isolate); static struct attribute *cpu_isolated_attrs[] = { &dev_attr_isolate.attr, NULL }; static struct attribute_group cpu_isolated_attr_group = { .attrs = cpu_isolated_attrs, }; #endif static const struct attribute_group *common_cpu_attr_groups[] = { #ifdef CONFIG_KEXEC &crash_note_cpu_attr_group, #endif #ifdef CONFIG_HOTPLUG_CPU &cpu_isolated_attr_group, #endif NULL }; Loading @@ -191,6 +222,9 @@ static const struct attribute_group *common_cpu_attr_groups[] = { static const struct attribute_group *hotplugable_cpu_attr_groups[] = { #ifdef CONFIG_KEXEC &crash_note_cpu_attr_group, #endif #ifdef CONFIG_HOTPLUG_CPU &cpu_isolated_attr_group, #endif NULL }; Loading
include/linux/cpumask.h +8 −0 Original line number Diff line number Diff line Loading @@ -104,6 +104,13 @@ extern struct cpumask __cpu_isolated_mask; #define num_present_cpus() cpumask_weight(cpu_present_mask) #define num_active_cpus() cpumask_weight(cpu_active_mask) #define num_isolated_cpus() cpumask_weight(cpu_isolated_mask) #define num_online_uniso_cpus() \ ({ \ cpumask_t mask; \ \ cpumask_andnot(&mask, cpu_online_mask, cpu_isolated_mask); \ cpumask_weight(&mask); \ }) #define cpu_online(cpu) cpumask_test_cpu((cpu), cpu_online_mask) #define cpu_possible(cpu) cpumask_test_cpu((cpu), cpu_possible_mask) #define cpu_present(cpu) cpumask_test_cpu((cpu), cpu_present_mask) Loading @@ -115,6 +122,7 @@ extern struct cpumask __cpu_isolated_mask; #define num_present_cpus() 1U #define num_active_cpus() 1U #define num_isolated_cpus() 0U #define num_online_uniso_cpus() 1U #define cpu_online(cpu) ((cpu) == 0) #define cpu_possible(cpu) ((cpu) == 0) #define cpu_present(cpu) ((cpu) == 0) Loading
include/linux/sched.h +35 −0 Original line number Diff line number Diff line Loading @@ -183,6 +183,41 @@ enum migrate_types { extern cpumask_var_t cpu_isolated_map; #ifdef CONFIG_HOTPLUG_CPU extern int sched_isolate_count(const cpumask_t *mask, bool include_offline); extern int sched_isolate_cpu(int cpu); extern int sched_unisolate_cpu(int cpu); extern int sched_unisolate_cpu_unlocked(int cpu); #else static inline int sched_isolate_count(const cpumask_t *mask, bool include_offline) { cpumask_t count_mask; if (include_offline) cpumask_andnot(&count_mask, mask, cpu_online_mask); else return 0; return cpumask_weight(&count_mask); } static inline int sched_isolate_cpu(int cpu) { return 0; } static inline int sched_unisolate_cpu(int cpu) { return 0; } static inline int sched_unisolate_cpu_unlocked(int cpu) { return 0; } #endif extern void scheduler_tick(void); #define MAX_SCHEDULE_TIMEOUT LONG_MAX Loading
include/linux/tick.h +10 −2 Original line number Diff line number Diff line Loading @@ -239,7 +239,15 @@ extern void __tick_nohz_task_switch(void); #else static inline int housekeeping_any_cpu(void) { return smp_processor_id(); cpumask_t available; int cpu; cpumask_andnot(&available, cpu_online_mask, cpu_isolated_mask); cpu = cpumask_any(&available); if (cpu >= nr_cpu_ids) cpu = smp_processor_id(); return cpu; } static inline bool tick_nohz_full_enabled(void) { return false; } static inline bool tick_nohz_full_cpu(int cpu) { return false; } Loading Loading @@ -277,7 +285,7 @@ static inline bool is_housekeeping_cpu(int cpu) if (tick_nohz_full_enabled()) return cpumask_test_cpu(cpu, housekeeping_mask); #endif return true; return !cpu_isolated(cpu); } static inline void housekeeping_affine(struct task_struct *t) Loading