From 402825050f95fff80a021e6eb04aa49a210648c9 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Wed, 23 Mar 2016 13:14:37 -0700 Subject: [PATCH] LU-8492 ptlrpc: Correctly calculate hrp->hrp_nthrs cpu_pattern can specify exactly 1 cpu in a partition: "0[0]". That means CPT0 will have CPU 0. CPU 0 can have hyperthreading enabled. This combination would result in weight = cfs_cpu_ht_nsiblings(0); hrp->hrp_nthrs = cfs_cpt_weight(ptlrpc_hr.hr_cpt_table, i); hrp->hrp_nthrs /= weight; evaluating to 0. Where cfs_cpt_weight(ptlrpc_hr.hr_cpt_table, i) == 1 weight == 2 Therefore, if hrp_nthrs becomes zero, just set it to 1. Signed-off-by: Amir Shehata Change-Id: Id89d381436b2c61354d925420f2efce8d9a54864 Reviewed-on: http://review.whamcloud.com/19106 Tested-by: Jenkins Reviewed-by: Liang Zhen Tested-by: Maloo Reviewed-by: Doug Oucharek Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lustre/ptlrpc/service.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 2de4753..af5dfda 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -2917,9 +2917,11 @@ int ptlrpc_hr_init(void) atomic_set(&hrp->hrp_nstopped, 0); hrp->hrp_nthrs = cfs_cpt_weight(ptlrpc_hr.hr_cpt_table, i); + hrp->hrp_nthrs /= weight; + if (hrp->hrp_nthrs == 0) + hrp->hrp_nthrs = 1; - LASSERT(hrp->hrp_nthrs > 0); OBD_CPT_ALLOC(hrp->hrp_thrs, ptlrpc_hr.hr_cpt_table, i, hrp->hrp_nthrs * sizeof(*hrt)); if (hrp->hrp_thrs == NULL) -- 1.8.3.1