From e56b6a340d9ddfb3ee5cf4bd2b947fd63bcb9947 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Mon, 27 Apr 2020 11:49:33 -0400 Subject: [PATCH] LU-9859 libcfs: hide struct cfs_cpt_table internals Exposing the internals of struct cfs_cpt_table in the libcfs header used by lustre makes it too tempting to use but those fields are not available for UP systems. Make cfs_cpt_table abstract so the lustre and LNet code will never use the internals and instead use the functions provided in libcfs_cpu.h. Linux-commit: commit a6fe6f584b6a1032c2e63e94d7a7a6f1436c3774 Change-Id: Ia2b3363bcee87e042a133cc7af9a912cbafb0d92 Signed-off-by: James Simmons Reviewed-on: https://review.whamcloud.com/38389 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Shaun Tancheff Reviewed-by: Yang Sheng Reviewed-by: Neil Brown Reviewed-by: Oleg Drokin --- libcfs/include/libcfs/libcfs_cpu.h | 34 ---------------------------------- libcfs/libcfs/libcfs_cpu.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/libcfs/include/libcfs/libcfs_cpu.h b/libcfs/include/libcfs/libcfs_cpu.h index e7ff6ae..44675f7 100644 --- a/libcfs/include/libcfs/libcfs_cpu.h +++ b/libcfs/include/libcfs/libcfs_cpu.h @@ -88,40 +88,6 @@ struct cfs_cpt_table; #ifdef CONFIG_SMP extern struct cfs_cpt_table *cfs_cpt_tab; -/** virtual processing unit */ -struct cfs_cpu_partition { - /* CPUs mask for this partition */ - cpumask_var_t cpt_cpumask; - /* nodes mask for this partition */ - nodemask_t *cpt_nodemask; - /* NUMA distance between CPTs */ - unsigned int *cpt_distance; - /* spread rotor for NUMA allocator */ - unsigned int cpt_spread_rotor; - /* NUMA node if cpt_nodemask is empty */ - int cpt_node; -}; - -/** descriptor for CPU partitions */ -struct cfs_cpt_table { - /* spread rotor for NUMA allocator */ - unsigned int ctb_spread_rotor; - /* maximum NUMA distance between all nodes in table */ - unsigned int ctb_distance; - /* # of CPU partitions */ - int ctb_nparts; - /* partitions tables */ - struct cfs_cpu_partition *ctb_parts; - /* shadow HW CPU to CPU partition ID */ - int *ctb_cpu2cpt; - /* all cpus in this partition table */ - cpumask_var_t ctb_cpumask; - /* shadow HW node to CPU partition ID */ - int *ctb_node2cpt; - /* all nodes in this partition table */ - nodemask_t *ctb_nodemask; -}; - /** * destroy a CPU partition table */ diff --git a/libcfs/libcfs/libcfs_cpu.c b/libcfs/libcfs/libcfs_cpu.c index 58a3a44..9fac258 100644 --- a/libcfs/libcfs/libcfs_cpu.c +++ b/libcfs/libcfs/libcfs_cpu.c @@ -35,6 +35,40 @@ #include #include +/** virtual processing unit */ +struct cfs_cpu_partition { + /* CPUs mask for this partition */ + cpumask_var_t cpt_cpumask; + /* nodes mask for this partition */ + nodemask_t *cpt_nodemask; + /* NUMA distance between CPTs */ + unsigned int *cpt_distance; + /* spread rotor for NUMA allocator */ + unsigned int cpt_spread_rotor; + /* NUMA node if cpt_nodemask is empty */ + int cpt_node; +}; + +/** descriptor for CPU partitions */ +struct cfs_cpt_table { + /* spread rotor for NUMA allocator */ + unsigned int ctb_spread_rotor; + /* maximum NUMA distance between all nodes in table */ + unsigned int ctb_distance; + /* # of CPU partitions */ + int ctb_nparts; + /* partitions tables */ + struct cfs_cpu_partition *ctb_parts; + /* shadow HW CPU to CPU partition ID */ + int *ctb_cpu2cpt; + /* all cpus in this partition table */ + cpumask_var_t ctb_cpumask; + /* shadow HW node to CPU partition ID */ + int *ctb_node2cpt; + /* all nodes in this partition table */ + nodemask_t *ctb_nodemask; +}; + /** Global CPU partition table */ struct cfs_cpt_table *cfs_cpt_tab __read_mostly; EXPORT_SYMBOL(cfs_cpt_tab); -- 1.8.3.1