From: Dmitry Eremin Date: Fri, 21 Oct 2016 12:38:46 +0000 (+0300) Subject: LU-8710 ptlrpc: use current CPU instead of harcoded 0 X-Git-Tag: 2.9.52~17 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ef94e4d1bb4350a811da6123993b8289d3d3c43e;hp=c96c0043e9794c6e7e72c241d11908381b9fbbc3 LU-8710 ptlrpc: use current CPU instead of harcoded 0 fix crash if CPU 0 disabled. Change-Id: I8ac5a10f544a1c8fc454bc64a6bb1d3607240be9 Signed-off-by: Dmitry Eremin Reviewed-on: https://review.whamcloud.com/23305 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Doug Oucharek Reviewed-by: Andreas Dilger --- diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index e42c307..4b57b9e 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -559,7 +559,8 @@ ptlrpc_server_nthreads_check(struct ptlrpc_service *svc, * have too many threads no matter how many cores/HTs * there are. */ - if (cfs_cpu_ht_nsiblings(0) > 1) { /* weight is # of HTs */ + if (cfs_cpu_ht_nsiblings(smp_processor_id()) > 1) { + /* weight is # of HTs */ /* depress thread factor for hyper-thread */ factor = factor - (factor >> 1) + (factor >> 3); } @@ -2585,16 +2586,17 @@ static int ptlrpc_hr_main(void *arg) struct ptlrpc_hr_thread *hrt = (struct ptlrpc_hr_thread *)arg; struct ptlrpc_hr_partition *hrp = hrt->hrt_partition; struct list_head replies; - char threadname[20]; int rc; INIT_LIST_HEAD(&replies); - snprintf(threadname, sizeof(threadname), "ptlrpc_hr%02d_%03d", - hrp->hrp_cpt, hrt->hrt_id); unshare_fs_struct(); rc = cfs_cpt_bind(ptlrpc_hr.hr_cpt_table, hrp->hrp_cpt); if (rc != 0) { + char threadname[20]; + + snprintf(threadname, sizeof(threadname), "ptlrpc_hr%02d_%03d", + hrp->hrp_cpt, hrt->hrt_id); CWARN("Failed to bind %s on CPT %d of CPT table %p: rc = %d\n", threadname, hrp->hrp_cpt, ptlrpc_hr.hr_cpt_table, rc); } @@ -2910,7 +2912,7 @@ int ptlrpc_hr_init(void) init_waitqueue_head(&ptlrpc_hr.hr_waitq); - weight = cfs_cpu_ht_nsiblings(0); + weight = cfs_cpu_ht_nsiblings(smp_processor_id()); cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) { hrp->hrp_cpt = i;