X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=libcfs%2Finclude%2Flibcfs%2Flibcfs_cpu.h;h=bd5ea2ab39a1143ee646a32e091be0b85822b6a8;hp=44675f729a6079356ab61627b031d1a824165ed9;hb=76b602c2bfe9d1b0ddaa14997a3056b19b3e90aa;hpb=33d08805f27bb9a4c374754505f2ef5431b9fd31 diff --git a/libcfs/include/libcfs/libcfs_cpu.h b/libcfs/include/libcfs/libcfs_cpu.h index 44675f7..bd5ea2a 100644 --- a/libcfs/include/libcfs/libcfs_cpu.h +++ b/libcfs/include/libcfs/libcfs_cpu.h @@ -297,6 +297,30 @@ static inline void cfs_cpu_fini(void) #endif /* CONFIG_SMP */ +static inline +struct workqueue_struct *cfs_cpt_bind_workqueue(const char *wq_name, + struct cfs_cpt_table *tbl, + int flags, int cpt, int nthrs) +{ + cpumask_var_t *mask = cfs_cpt_cpumask(tbl, cpt); + struct workqueue_attrs attrs = { }; + struct workqueue_struct *wq; + + wq = alloc_workqueue(wq_name, WQ_UNBOUND | flags, nthrs); + if (!wq) + return ERR_PTR(-ENOMEM); + + if (mask && alloc_cpumask_var(&attrs.cpumask, GFP_KERNEL)) { + cpumask_copy(attrs.cpumask, *mask); + cpus_read_lock(); + cfs_apply_workqueue_attrs(wq, &attrs); + cpus_read_unlock(); + free_cpumask_var(attrs.cpumask); + } + + return wq; +} + /* * allocate per-cpu-partition data, returned value is an array of pointers, * variable can be indexed by CPU ID.