Whamcloud - gitweb
LU-13258 libcfs: make apply_workqueue_attrs() available for Lustre 13/37613/2
authorJames Simmons <jsimmons@infradead.org>
Mon, 17 Feb 2020 19:34:41 +0000 (14:34 -0500)
committerOleg Drokin <green@whamcloud.com>
Tue, 25 Feb 2020 05:52:07 +0000 (05:52 +0000)
Currently Lustre work queues can run on any core which introduces
noise on the system. The linux kernel has a function called
apply_workqueue_attrs() which allows you to control which cores
a work queue will execute on. Manually export this function so
Lustre can use it.

Test-Parameters: trivial

Change-Id: I467539cb8def7029fa9dfff2386234de5e0fe133
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/37613
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Jian Yu <yujian@whamcloud.com>
Reviewed-by: Shaun Tancheff <shaun.tancheff@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/include/libcfs/linux/linux-misc.h
libcfs/libcfs/linux/linux-prim.c
libcfs/libcfs/module.c

index 1e45e8f..bff63ba 100644 (file)
@@ -85,10 +85,16 @@ static inline void kernel_param_lock(struct module *mod)
 }
 #endif /* ! HAVE_KERNEL_PARAM_LOCK */
 
+int cfs_apply_workqueue_attrs(struct workqueue_struct *wq,
+                             const struct workqueue_attrs *attrs);
+
 #ifndef HAVE_KSTRTOBOOL_FROM_USER
 
 #define kstrtobool strtobool
 
 int kstrtobool_from_user(const char __user *s, size_t count, bool *res);
-#endif
-#endif
+#endif /* HAVE_KSTRTOBOOL_FROM_USER */
+
+void cfs_arch_init(void);
+
+#endif /* __LIBCFS_LINUX_MISC_H__ */
index f54a5f9..1f29c52 100644 (file)
@@ -31,6 +31,8 @@
  */
 
 #define DEBUG_SUBSYSTEM S_LNET
+
+#include <linux/kallsyms.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/fs.h>
@@ -102,6 +104,27 @@ time64_t ktime_get_seconds(void)
 EXPORT_SYMBOL(ktime_get_seconds);
 #endif /* HAVE_KTIME_GET_SECONDS */
 
+static int (*cfs_apply_workqueue_attrs_t)(struct workqueue_struct *wq,
+                                         const struct workqueue_attrs *attrs);
+
+int cfs_apply_workqueue_attrs(struct workqueue_struct *wq,
+                             const struct workqueue_attrs *attrs)
+{
+       return cfs_apply_workqueue_attrs_t(wq, attrs);
+}
+EXPORT_SYMBOL_GPL(cfs_apply_workqueue_attrs);
+
+struct kmem_cache (*cfs_radix_tree_node_cachep);
+
+void cfs_arch_init(void)
+{
+#ifndef HAVE_WAIT_VAR_EVENT
+       wait_bit_init();
+#endif
+       cfs_apply_workqueue_attrs_t =
+               (void *)kallsyms_lookup_name("apply_workqueue_attrs");
+}
+
 int cfs_kernel_write(struct file *filp, const void *buf, size_t count,
                     loff_t *pos)
 {
index bb6abb6..81c1f6f 100644 (file)
@@ -719,9 +719,8 @@ static int __init libcfs_init(void)
 {
        int rc;
 
-#ifndef HAVE_WAIT_VAR_EVENT
-       wait_bit_init();
-#endif
+       cfs_arch_init();
+
        rc = libcfs_debug_init(5 * 1024 * 1024);
        if (rc < 0) {
                pr_err("LustreError: libcfs_debug_init: rc = %d\n", rc);