From: James Simmons Date: Tue, 25 Aug 2015 19:24:56 +0000 (-0400) Subject: LU-6215 libcfs: handle topology_thread_cpumask rename X-Git-Tag: 2.7.59~5 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=aa637a7be1dd34840fc512365e312857c4b0e756 LU-6215 libcfs: handle topology_thread_cpumask rename 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 Reviewed-on: http://review.whamcloud.com/16049 Reviewed-by: frank zago Reviewed-by: Bob Glossman Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/libcfs/autoconf/lustre-libcfs.m4 b/libcfs/autoconf/lustre-libcfs.m4 index 5c76eda..c787203 100644 --- a/libcfs/autoconf/lustre-libcfs.m4 +++ b/libcfs/autoconf/lustre-libcfs.m4 @@ -288,7 +288,7 @@ shrinker_count_objects, [ # 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 ],[ @@ -300,6 +300,24 @@ 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 +],[ + 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 @@ -336,6 +354,8 @@ LIBCFS_ENABLE_CRC32C_ACCEL LIBCFS_SHRINKER_COUNT # 3.17 LIBCFS_HLIST_ADD_AFTER +# 4.2 +LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK ]) # LIBCFS_PROG_LINUX # diff --git a/libcfs/include/libcfs/linux/linux-cpu.h b/libcfs/include/libcfs/linux/linux-cpu.h index 270f5ab..b7f2e43 100644 --- a/libcfs/include/libcfs/linux/linux-cpu.h +++ b/libcfs/include/libcfs/linux/linux-cpu.h @@ -91,4 +91,9 @@ int cfs_cpu_core_nsiblings(int cpu); 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__ */ diff --git a/libcfs/libcfs/linux/linux-cpu.c b/libcfs/libcfs/linux/linux-cpu.c index 243455b..b0c55e8 100644 --- a/libcfs/libcfs/linux/linux-cpu.c +++ b/libcfs/libcfs/linux/linux-cpu.c @@ -106,7 +106,7 @@ cfs_cpu_core_nsiblings(int cpu) 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 */ @@ -115,7 +115,7 @@ cfs_cpu_ht_nsiblings(int cpu) { int num; - num = cpumask_weight(topology_thread_cpumask(cpu)); + num = cpumask_weight(topology_sibling_cpumask(cpu)); return num; }