diff options
-rw-r--r-- | include/linux/cpumask.h | 53 | ||||
-rw-r--r-- | kernel/cpu.c | 47 |
2 files changed, 54 insertions, 46 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index e62a67156c53..7c178a6baae3 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -1057,50 +1057,11 @@ extern const DECLARE_BITMAP(cpu_all_bits, NR_CPUS); | |||
1057 | #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) | 1057 | #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) |
1058 | 1058 | ||
1059 | /* Wrappers for arch boot code to manipulate normally-constant masks */ | 1059 | /* Wrappers for arch boot code to manipulate normally-constant masks */ |
1060 | static inline void set_cpu_possible(unsigned int cpu, bool possible) | 1060 | void set_cpu_possible(unsigned int cpu, bool possible); |
1061 | { | 1061 | void set_cpu_present(unsigned int cpu, bool present); |
1062 | if (possible) | 1062 | void set_cpu_online(unsigned int cpu, bool online); |
1063 | cpumask_set_cpu(cpu, &cpu_possible_map); | 1063 | void set_cpu_active(unsigned int cpu, bool active); |
1064 | else | 1064 | void init_cpu_present(const struct cpumask *src); |
1065 | cpumask_clear_cpu(cpu, &cpu_possible_map); | 1065 | void init_cpu_possible(const struct cpumask *src); |
1066 | } | 1066 | void init_cpu_online(const struct cpumask *src); |
1067 | |||
1068 | static inline void set_cpu_present(unsigned int cpu, bool present) | ||
1069 | { | ||
1070 | if (present) | ||
1071 | cpumask_set_cpu(cpu, &cpu_present_map); | ||
1072 | else | ||
1073 | cpumask_clear_cpu(cpu, &cpu_present_map); | ||
1074 | } | ||
1075 | |||
1076 | static inline void set_cpu_online(unsigned int cpu, bool online) | ||
1077 | { | ||
1078 | if (online) | ||
1079 | cpumask_set_cpu(cpu, &cpu_online_map); | ||
1080 | else | ||
1081 | cpumask_clear_cpu(cpu, &cpu_online_map); | ||
1082 | } | ||
1083 | |||
1084 | static inline void set_cpu_active(unsigned int cpu, bool active) | ||
1085 | { | ||
1086 | if (active) | ||
1087 | cpumask_set_cpu(cpu, &cpu_active_map); | ||
1088 | else | ||
1089 | cpumask_clear_cpu(cpu, &cpu_active_map); | ||
1090 | } | ||
1091 | |||
1092 | static inline void init_cpu_present(const struct cpumask *src) | ||
1093 | { | ||
1094 | cpumask_copy(&cpu_present_map, src); | ||
1095 | } | ||
1096 | |||
1097 | static inline void init_cpu_possible(const struct cpumask *src) | ||
1098 | { | ||
1099 | cpumask_copy(&cpu_possible_map, src); | ||
1100 | } | ||
1101 | |||
1102 | static inline void init_cpu_online(const struct cpumask *src) | ||
1103 | { | ||
1104 | cpumask_copy(&cpu_online_map, src); | ||
1105 | } | ||
1106 | #endif /* __LINUX_CPUMASK_H */ | 1067 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/kernel/cpu.c b/kernel/cpu.c index 3ddc509b19c5..2c9f78f3a2fc 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -500,3 +500,50 @@ EXPORT_SYMBOL(cpu_present_mask); | |||
500 | static DECLARE_BITMAP(cpu_active_bits, CONFIG_NR_CPUS) __read_mostly; | 500 | static DECLARE_BITMAP(cpu_active_bits, CONFIG_NR_CPUS) __read_mostly; |
501 | const struct cpumask *const cpu_active_mask = to_cpumask(cpu_active_bits); | 501 | const struct cpumask *const cpu_active_mask = to_cpumask(cpu_active_bits); |
502 | EXPORT_SYMBOL(cpu_active_mask); | 502 | EXPORT_SYMBOL(cpu_active_mask); |
503 | |||
504 | void set_cpu_possible(unsigned int cpu, bool possible) | ||
505 | { | ||
506 | if (possible) | ||
507 | cpumask_set_cpu(cpu, to_cpumask(cpu_possible_bits)); | ||
508 | else | ||
509 | cpumask_clear_cpu(cpu, to_cpumask(cpu_possible_bits)); | ||
510 | } | ||
511 | |||
512 | void set_cpu_present(unsigned int cpu, bool present) | ||
513 | { | ||
514 | if (present) | ||
515 | cpumask_set_cpu(cpu, to_cpumask(cpu_present_bits)); | ||
516 | else | ||
517 | cpumask_clear_cpu(cpu, to_cpumask(cpu_present_bits)); | ||
518 | } | ||
519 | |||
520 | void set_cpu_online(unsigned int cpu, bool online) | ||
521 | { | ||
522 | if (online) | ||
523 | cpumask_set_cpu(cpu, to_cpumask(cpu_online_bits)); | ||
524 | else | ||
525 | cpumask_clear_cpu(cpu, to_cpumask(cpu_online_bits)); | ||
526 | } | ||
527 | |||
528 | void set_cpu_active(unsigned int cpu, bool active) | ||
529 | { | ||
530 | if (active) | ||
531 | cpumask_set_cpu(cpu, to_cpumask(cpu_active_bits)); | ||
532 | else | ||
533 | cpumask_clear_cpu(cpu, to_cpumask(cpu_active_bits)); | ||
534 | } | ||
535 | |||
536 | void init_cpu_present(const struct cpumask *src) | ||
537 | { | ||
538 | cpumask_copy(to_cpumask(cpu_present_bits), src); | ||
539 | } | ||
540 | |||
541 | void init_cpu_possible(const struct cpumask *src) | ||
542 | { | ||
543 | cpumask_copy(to_cpumask(cpu_possible_bits), src); | ||
544 | } | ||
545 | |||
546 | void init_cpu_online(const struct cpumask *src) | ||
547 | { | ||
548 | cpumask_copy(to_cpumask(cpu_online_bits), src); | ||
549 | } | ||