From 77855d6b2b9e790ae47bf0e3bf96cd58c1b449f4 Mon Sep 17 00:00:00 2001 From: Qiao Nuohan Date: Fri, 12 Sep 2014 14:06:03 +0800 Subject: [PATCH 1/3] add an API to check an offline cpu check_offline_cpu() is used to check whether a cpu is logically removed(offline). Signed-off-by: Qiao Nuohan --- defs.h | 1 + kernel.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/defs.h b/defs.h index cbdaa47..8fbbdeb 100755 --- a/defs.h +++ b/defs.h @@ -4893,6 +4893,7 @@ int get_cpus_online(void); int get_cpus_active(void); int get_cpus_present(void); int get_cpus_possible(void); +int check_offline_cpu(int); int get_highest_cpu_online(void); int get_highest_cpu_present(void); int get_cpus_to_display(void); diff --git a/kernel.c b/kernel.c index 87a0b75..8d3db9c 100755 --- a/kernel.c +++ b/kernel.c @@ -7988,6 +7988,18 @@ get_cpus_online() return online; } +int +check_offline_cpu(int cpu) +{ + if (!cpu_map_addr("online")) + return FALSE; + + if (in_cpu_map(ONLINE_MAP, cpu)) + return FALSE; + + return TRUE; +} + /* * If it exists, return the highest cpu number in the cpu_online_map. */ -- 1.8.5.3