Whamcloud - gitweb
LU-4423 ptlrpc: Fix using smp_processor_id() in preemptible context 95/35495/2
authorJames Simmons <uja.ornl@yahoo.com>
Sat, 13 Jul 2019 15:00:32 +0000 (11:00 -0400)
committerOleg Drokin <green@whamcloud.com>
Sat, 20 Jul 2019 18:39:28 +0000 (18:39 +0000)
This warning show up with kernels that enable preemptible
[ 1877.516799] BUG: using smp_processor_id() in preemptible [00000000] code: mount.lustre/14077

Change it to disable preemption around smp_processor_id().

Linux-commit: c369772e78a7383ba4e68673128fe2d6ef2863ee

Fixes: ef94e4d1bb ("LU-8710 ptlrpc: use current CPU instead of hardcoded 0")

Change-Id: If66107f0843c5d0c4bcf874e64a20251fdf9704e
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/35495
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Shaun Tancheff <stancheff@cray.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Neil Brown <neilb@suse.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/ptlrpc/service.c

index 44dfec0..e8e887c 100644 (file)
@@ -571,12 +571,14 @@ static void ptlrpc_server_nthreads_check(struct ptlrpc_service *svc,
                 * have too many threads no matter how many cores/HTs
                 * there are.
                 */
+               preempt_disable();
                if (cpumask_weight
                    (topology_sibling_cpumask(smp_processor_id())) > 1) {
                        /* weight is # of HTs */
                        /* depress thread factor for hyper-thread */
                        factor = factor - (factor >> 1) + (factor >> 3);
                }
+               preempt_enable();
 
                weight = cfs_cpt_weight(svc->srv_cptable, 0);
 
@@ -3230,7 +3232,9 @@ int ptlrpc_hr_init(void)
 
        init_waitqueue_head(&ptlrpc_hr.hr_waitq);
 
+       preempt_disable();
        weight = cpumask_weight(topology_sibling_cpumask(smp_processor_id()));
+       preempt_enable();
 
        cfs_percpt_for_each(hrp, cpt, ptlrpc_hr.hr_partitions) {
                hrp->hrp_cpt = cpt;