Whamcloud - gitweb
LU-6215 libcfs: handle topology_thread_cpumask rename 49/16049/3
authorJames Simmons <uja.ornl@yahoo.com>
Tue, 25 Aug 2015 19:24:56 +0000 (15:24 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Sat, 29 Aug 2015 01:03:48 +0000 (01:03 +0000)
For linux kernel version 4.2 we see topology_thread_cpumask get
renamed in commit 06931e62246844c73fba24d7aeb4a5dc897a2739.
This patch handles this rename.

Change-Id: I7437be9a086a38762346e271b346059ccfa13a8c
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: http://review.whamcloud.com/16049
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/autoconf/lustre-libcfs.m4
libcfs/include/libcfs/linux/linux-cpu.h
libcfs/libcfs/linux/linux-cpu.c

index 5c76eda..c787203 100644 (file)
@@ -288,7 +288,7 @@ shrinker_count_objects, [
 # hlist_add_behind
 #
 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
 # hlist_add_behind
 #
 AC_DEFUN([LIBCFS_HLIST_ADD_AFTER],[
-LB_CHECK_COMPILE([does function hlist_add_after exist'],
+LB_CHECK_COMPILE([does function 'hlist_add_after' exist],
 hlist_add_after, [
        #include <linux/list.h>
 ],[
 hlist_add_after, [
        #include <linux/list.h>
 ],[
@@ -300,6 +300,24 @@ hlist_add_after, [
 ]) # LIBCFS_HLIST_ADD_AFTER
 
 #
 ]) # LIBCFS_HLIST_ADD_AFTER
 
 #
+# Kernel version 4.2 changed topology_thread_cpumask
+# to topology_sibling_cpumask
+#
+AC_DEFUN([LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK],[
+LB_CHECK_COMPILE([does function 'topology_sibling_cpumask' exist],
+topology_sibling_cpumask, [
+       #include <linux/topology.h>
+],[
+       const struct cpumask *mask;
+
+       mask = topology_sibling_cpumask(0);
+],[
+       AC_DEFINE(HAVE_TOPOLOGY_SIBLING_CPUMASK, 1,
+               [topology_sibling_cpumask is available])
+])
+]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
+
+#
 # LIBCFS_PROG_LINUX
 #
 # LibCFS linux kernel checks
 # LIBCFS_PROG_LINUX
 #
 # LibCFS linux kernel checks
@@ -336,6 +354,8 @@ LIBCFS_ENABLE_CRC32C_ACCEL
 LIBCFS_SHRINKER_COUNT
 # 3.17
 LIBCFS_HLIST_ADD_AFTER
 LIBCFS_SHRINKER_COUNT
 # 3.17
 LIBCFS_HLIST_ADD_AFTER
+# 4.2
+LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
 ]) # LIBCFS_PROG_LINUX
 
 #
 ]) # LIBCFS_PROG_LINUX
 
 #
index 270f5ab..b7f2e43 100644 (file)
@@ -91,4 +91,9 @@ int cfs_cpu_core_nsiblings(int cpu);
 int cfs_cpu_ht_nsiblings(int cpu);
 
 #endif /* CONFIG_SMP */
 int cfs_cpu_ht_nsiblings(int cpu);
 
 #endif /* CONFIG_SMP */
+
+#ifndef HAVE_TOPOLOGY_SIBLING_CPUMASK
+# define topology_sibling_cpumask(cpu) topology_thread_cpumask(cpu)
+#endif /* HAVE_TOPOLOGY_SIBLING_CPUMASK */
+
 #endif /* __LIBCFS_LINUX_CPU_H__ */
 #endif /* __LIBCFS_LINUX_CPU_H__ */
index 243455b..b0c55e8 100644 (file)
@@ -106,7 +106,7 @@ cfs_cpu_core_nsiblings(int cpu)
 void
 cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
 {
 void
 cfs_cpu_ht_siblings(int cpu, cpumask_t *mask)
 {
-       cpumask_copy(mask, topology_thread_cpumask(cpu));
+       cpumask_copy(mask, topology_sibling_cpumask(cpu));
 }
 
 /* return number of HTs in the same core of \a cpu */
 }
 
 /* return number of HTs in the same core of \a cpu */
@@ -115,7 +115,7 @@ cfs_cpu_ht_nsiblings(int cpu)
 {
        int     num;
 
 {
        int     num;
 
-       num = cpumask_weight(topology_thread_cpumask(cpu));
+       num = cpumask_weight(topology_sibling_cpumask(cpu));
 
        return num;
 }
 
        return num;
 }