From: Oleg Drokin Date: Fri, 27 Feb 2015 07:59:05 +0000 (-0500) Subject: LU-6285 ptlrpc: Do not recalculate siblings of CPU 0 in a loop X-Git-Tag: 2.7.52~18 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=0eb4582d87e32dd3e5491e13ba659e625624bfe7;hp=b4f41e5fef3ff644f9adb95921329ef59e1e3e74 LU-6285 ptlrpc: Do not recalculate siblings of CPU 0 in a loop 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 Reviewed-on: http://review.whamcloud.com/13905 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Liang Zhen Reviewed-by: Dmitry Eremin Reviewed-by: James Simmons --- diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c index 267685c..586b1e9 100644 --- a/lustre/ptlrpc/service.c +++ b/lustre/ptlrpc/service.c @@ -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,