From c324460b630aaa0bee921d5685e4b5db51c65de9 Mon Sep 17 00:00:00 2001 From: James Simmons Date: Sat, 13 Jul 2019 11:00:32 -0400 Subject: [PATCH] LU-4423 ptlrpc: Fix using smp_processor_id() in preemptible context 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 Reviewed-on: https://review.whamcloud.com/35495 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Shaun Tancheff Reviewed-by: Andreas Dilger Reviewed-by: Petros Koutoupis Reviewed-by: Neil Brown Reviewed-by: Oleg Drokin --- lustre/ptlrpc/service.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 44dfec0..e8e887c 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -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; -- 1.8.3.1