Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752365AbcKGB63 (ORCPT ); Sun, 6 Nov 2016 20:58:29 -0500 Received: from casper.infradead.org ([85.118.1.10]:56908 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751541AbcKGB6T (ORCPT ); Sun, 6 Nov 2016 20:58:19 -0500 Date: Mon, 7 Nov 2016 01:58:17 +0000 (GMT) From: James Simmons To: Oleg Drokin cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Linux Kernel Mailing List , Lustre Development List , Amir Shehata Subject: Re: [PATCH 11/14] staging/lustre/ptlrpc: Correctly calculate hrp->hrp_nthrs In-Reply-To: <1478136304-867780-12-git-send-email-green@linuxhacker.ru> Message-ID: References: <1478136304-867780-1-git-send-email-green@linuxhacker.ru> <1478136304-867780-12-git-send-email-green@linuxhacker.ru> User-Agent: Alpine 2.20 (LFD 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161107_015817_735579_9533FFA3 X-CRM114-Status: GOOD ( 11.81 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 NO_RELAYS Informational: message was not relayed via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1739 Lines: 50 On Wed, 2 Nov 2016, Oleg Drokin wrote: > From: Amir Shehata > > 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. Reviewed-by: James Simmons > Signed-off-by: Amir Shehata > Reviewed-on: http://review.whamcloud.com/19106 > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-8492 > Reviewed-by: Liang Zhen > Reviewed-by: Doug Oucharek > Reviewed-by: James Simmons > Signed-off-by: Oleg Drokin > --- > drivers/staging/lustre/lustre/ptlrpc/service.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/lustre/lustre/ptlrpc/service.c b/drivers/staging/lustre/lustre/ptlrpc/service.c > index 72f3930..fc754e7 100644 > --- a/drivers/staging/lustre/lustre/ptlrpc/service.c > +++ b/drivers/staging/lustre/lustre/ptlrpc/service.c > @@ -2541,8 +2541,9 @@ int ptlrpc_hr_init(void) > > 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); > hrp->hrp_thrs = > kzalloc_node(hrp->hrp_nthrs * sizeof(*hrt), GFP_NOFS, > cfs_cpt_spread_node(ptlrpc_hr.hr_cpt_table, > -- > 2.7.4 > >