Whamcloud - gitweb
LU-8492 ptlrpc: Correctly calculate hrp->hrp_nthrs 06/19106/6
authorAmir Shehata <amir.shehata@intel.com>
Wed, 23 Mar 2016 20:14:37 +0000 (13:14 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 25 Oct 2016 02:23:35 +0000 (02:23 +0000)
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 <amir.shehata@intel.com>
Change-Id: Id89d381436b2c61354d925420f2efce8d9a54864
Reviewed-on: http://review.whamcloud.com/19106
Tested-by: Jenkins
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/service.c

index 2de4753..af5dfda 100644 (file)
@@ -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);
                atomic_set(&hrp->hrp_nstopped, 0);
 
                hrp->hrp_nthrs = cfs_cpt_weight(ptlrpc_hr.hr_cpt_table, i);
+
                hrp->hrp_nthrs /= weight;
                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)
                OBD_CPT_ALLOC(hrp->hrp_thrs, ptlrpc_hr.hr_cpt_table, i,
                              hrp->hrp_nthrs * sizeof(*hrt));
                if (hrp->hrp_thrs == NULL)