Whamcloud - gitweb
LU-6285 ptlrpc: Do not recalculate siblings of CPU 0 in a loop 05/13905/3
authorOleg Drokin <oleg.drokin@intel.com>
Fri, 27 Feb 2015 07:59:05 +0000 (02:59 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 6 Apr 2015 01:04:09 +0000 (01:04 +0000)
ptlrpc_hr_init seems to be recalculating number of siblings of CPU0
in a loop which is wasteful. Just precalculate the value before the
loop and use it in every iteration instead.

Change-Id: I807fddf29a75af4d268829e37dc91b7512cfcc50
Signed-off-by: Oleg Drokin <oleg.drokin@intel.com>
Reviewed-on: http://review.whamcloud.com/13905
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
lustre/ptlrpc/service.c

index 267685c..586b1e9 100644 (file)
@@ -2896,6 +2896,7 @@ int ptlrpc_hr_init(void)
        int                             rc;
        int                             i;
        int                             j;
+       int                             weight;
        ENTRY;
 
        memset(&ptlrpc_hr, 0, sizeof(ptlrpc_hr));
@@ -2908,6 +2909,8 @@ int ptlrpc_hr_init(void)
 
        init_waitqueue_head(&ptlrpc_hr.hr_waitq);
 
+       weight = cfs_cpu_ht_nsiblings(0);
+
        cfs_percpt_for_each(hrp, i, ptlrpc_hr.hr_partitions) {
                hrp->hrp_cpt = i;
 
@@ -2915,7 +2918,7 @@ 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 /= cfs_cpu_ht_nsiblings(0);
+               hrp->hrp_nthrs /= weight;
 
                LASSERT(hrp->hrp_nthrs > 0);
                OBD_CPT_ALLOC(hrp->hrp_thrs, ptlrpc_hr.hr_cpt_table, i,