summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
f12b088)
Some architectures, especially x86_64, do not have cpu_to_node()
defined as a macro, and node_to_cpumask() exported by the kernel
anymore.
The cpu_to_node() routine is defined either as a macro, as an inline
routine using another exported symbol, or as an exported symbol.
Anyway, the kernel defines this service since at least version
2.6.12.
The node_to_cpumask() routine has been replaced by cpumask_of_node()
for x86 architectures since kernel version 2.6.30.
The set_cpus_allowed() routine is not defined if
CONFIG_CPUMASK_OFFSTACK=y since kernel version 2.6.32.
Signed-off-by: Gregoire Pichon <gregoire.pichon@bull.net>
Change-Id: If81269f403f888d4cde89c6fda5a8d7e10ea70b0
Reviewed-on: http://review.whamcloud.com/1345
Reviewed-by: Bobi Jam <bobijam@whamcloud.com>
Tested-by: Hudson
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Liang Zhen <liang@whamcloud.com>
#define CFS_NR_CPUS 1
#endif
#define CFS_NR_CPUS 1
#endif
+#ifdef HAVE_SET_CPUS_ALLOWED
#define cfs_set_cpus_allowed(t, mask) set_cpus_allowed(t, mask)
#define cfs_set_cpus_allowed(t, mask) set_cpus_allowed(t, mask)
+#else
+#define cfs_set_cpus_allowed(t, mask) set_cpus_allowed_ptr(t, &(mask))
+#endif
+
+# 2.6.30 x86 node_to_cpumask has been removed. must use cpumask_of_node
+AC_DEFUN([LC_EXPORT_CPUMASK_OF_NODE],
+ [LB_CHECK_SYMBOL_EXPORT([node_to_cpumask_map],
+ [arch/$LINUX_ARCH/mm/numa.c],
+ [AC_DEFINE(HAVE_CPUMASK_OF_NODE, 1,
+ [node_to_cpumask_map is exported by
+ the kernel])]) # x86_64
+ ])
+
# 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
[AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
# 2.6.31 replaces blk_queue_hardsect_size by blk_queue_logical_block_size function
AC_DEFUN([LC_BLK_QUEUE_LOG_BLK_SIZE],
[AC_MSG_CHECKING([if blk_queue_logical_block_size is defined])
EXTRA_KCFLAGS=$tmp_flags
])
EXTRA_KCFLAGS=$tmp_flags
])
+# 2.6.32 set_cpus_allowed is no more defined if CONFIG_CPUMASK_OFFSTACK=yes
+AC_DEFUN([LC_SET_CPUS_ALLOWED],
+ [AC_MSG_CHECKING([if kernel defines set_cpus_allowed])
+ LB_LINUX_TRY_COMPILE(
+ [#include <linux/sched.h>],
+ [struct task_struct *p = NULL;
+ cpumask_t mask = { { 0 } };
+ (void) set_cpus_allowed(p, mask);],
+ [AC_MSG_RESULT([yes])
+ AC_DEFINE(HAVE_SET_CPUS_ALLOWED, 1,
+ [set_cpus_allowed is exported by the kernel])],
+ [AC_MSG_RESULT([no])] )])
+
#
# LC_D_OBTAIN_ALIAS
# starting from 2.6.28 kernel replaces d_alloc_anon() with
#
# LC_D_OBTAIN_ALIAS
# starting from 2.6.28 kernel replaces d_alloc_anon() with
LC_SB_HAS_QUOTA_ACTIVE
LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
LC_SB_HAS_QUOTA_ACTIVE
LC_EXPORT_ADD_TO_PAGE_CACHE_LRU
+ # 2.6.30
+ LC_EXPORT_CPUMASK_OF_NODE
+
# 2.6.31
LC_BLK_QUEUE_LOG_BLK_SIZE
# 2.6.31
LC_BLK_QUEUE_LOG_BLK_SIZE
LC_SB_BDI
LC_BLK_QUEUE_MAX_SECTORS
LC_BLK_QUEUE_MAX_SEGMENTS
LC_SB_BDI
LC_BLK_QUEUE_MAX_SECTORS
LC_BLK_QUEUE_MAX_SEGMENTS
# 2.6.38
LC_BLKDEV_GET_BY_DEV
# 2.6.38
LC_BLKDEV_GET_BY_DEV
#define cfs_for_each_possible_cpu(cpu) for_each_cpu(cpu)
#endif
#define cfs_for_each_possible_cpu(cpu) for_each_cpu(cpu)
#endif
-#ifndef cpu_to_node
-#define cpu_to_node(cpu) 0
-#endif
-
#ifdef HAVE_BIO_ENDIO_2ARG
#define cfs_bio_io_error(a,b) bio_io_error((a))
#define cfs_bio_endio(a,b,c) bio_endio((a),(c))
#ifdef HAVE_BIO_ENDIO_2ARG
#define cfs_bio_io_error(a,b) bio_io_error((a))
#define cfs_bio_endio(a,b,c) bio_endio((a),(c))
#define ll_pagevec_lru_add_file(pv) pagevec_lru_add_file(pv)
#endif
#define ll_pagevec_lru_add_file(pv) pagevec_lru_add_file(pv)
#endif
+#if !defined(HAVE_NODE_TO_CPUMASK) && defined(HAVE_CPUMASK_OF_NODE)
+#define node_to_cpumask(i) (*(cpumask_of_node(i)))
+#define HAVE_NODE_TO_CPUMASK
+#endif
+
#endif /* __KERNEL__ */
#endif /* _COMPAT25_H */
#endif /* __KERNEL__ */
#endif /* _COMPAT25_H */
"ptlrpc_hr_%d", hr_args->thread_index);
cfs_daemonize_ctxt(threadname);
"ptlrpc_hr_%d", hr_args->thread_index);
cfs_daemonize_ctxt(threadname);
-#if defined(CONFIG_SMP) && defined(HAVE_NODE_TO_CPUMASK)
+#if defined(CONFIG_NUMA) && defined(HAVE_NODE_TO_CPUMASK)
cfs_set_cpus_allowed(cfs_current(),
node_to_cpumask(cpu_to_node(hr_args->cpu_index)));
#endif
cfs_set_cpus_allowed(cfs_current(),
node_to_cpumask(cpu_to_node(hr_args->cpu_index)));
#endif