From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755940AbcKJS7K (ORCPT ); Thu, 10 Nov 2016 13:59:10 -0500 Received: from casper.infradead.org ([85.118.1.10]:59972 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755802AbcKJS7H (ORCPT ); Thu, 10 Nov 2016 13:59:07 -0500 Date: Thu, 10 Nov 2016 18:59:03 +0000 (GMT) From: James Simmons To: Arnd Bergmann cc: Greg Kroah-Hartman , "Dilger, Andreas" , "devel@driverdev.osuosl.org" , "Drokin, Oleg" , Linux Kernel Mailing List , Lustre Development List Subject: Re: [PATCH v2] staging: lustre: ldlm: pl_recalc time handling is wrong In-Reply-To: <4839295.T6k2aHkh3K@wuerfel> Message-ID: References: <1478573240-12850-1-git-send-email-jsimmons@infradead.org> <1594836.LAbS3nYoXQ@wuerfel> <20161110122108.GA7580@kroah.com> <4839295.T6k2aHkh3K@wuerfel> 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-20161110_185903_414903_9AC6B7B9 X-CRM114-Status: GOOD ( 19.84 ) 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 > James Simmons reports: > > The ldlm_pool field pl_recalc_time is set to the current > > monotonic clock value but the interval period is calculated > > with the wall clock. This means the interval period will > > always be far larger than the pl_recalc_period, which is > > just a small interval time period. The correct thing to > > do is to use monotomic clock current value instead of the > > wall clocks value when calculating recalc_interval_sec. > > This broke when I converted the 32-bit get_seconds() into > ktime_get_{real_,}seconds() inconsistently. Either > one of those two would have worked, but mixing them > does not. > > Staying with the original intention of the patch, this > changes the ktime_get_seconds() calls into ktime_get_real_seconds(), > using real time instead of mononic time. Reviewed-by: James Simmons > Cc: stable@vger.kernel.org # v4.4+ > Fixes: 8f83409cf238 ("staging/lustre: use 64-bit time for pl_recalc") > Reported-by: James Simmons > Signed-off-by: Arnd Bergmann > --- > v2: James' patch was similarly incomplete to mine, as it only > addressed some of the calls. With this new version, all ktime > accessors use the same time domain. > > diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c > index 19831c555c49..b820309d70e3 100644 > --- a/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c > +++ b/drivers/staging/lustre/lustre/ldlm/ldlm_pool.c > @@ -356,10 +356,10 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl) > u32 recalc_interval_sec; > int count; > > - recalc_interval_sec = ktime_get_seconds() - pl->pl_recalc_time; > + recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time; > if (recalc_interval_sec > 0) { > spin_lock(&pl->pl_lock); > - recalc_interval_sec = ktime_get_seconds() - pl->pl_recalc_time; > + recalc_interval_sec = ktime_get_real_seconds() - pl->pl_recalc_time; > > if (recalc_interval_sec > 0) { > /* > @@ -382,7 +382,7 @@ static int ldlm_pool_recalc(struct ldlm_pool *pl) > count); > } > > - recalc_interval_sec = pl->pl_recalc_time - ktime_get_seconds() + > + recalc_interval_sec = pl->pl_recalc_time - ktime_get_real_seconds() + > pl->pl_recalc_period; > if (recalc_interval_sec <= 0) { > /* DEBUG: should be re-removed after LU-4536 is fixed */ > @@ -657,7 +657,7 @@ int ldlm_pool_init(struct ldlm_pool *pl, struct ldlm_namespace *ns, > > spin_lock_init(&pl->pl_lock); > atomic_set(&pl->pl_granted, 0); > - pl->pl_recalc_time = ktime_get_seconds(); > + pl->pl_recalc_time = ktime_get_real_seconds(); > atomic_set(&pl->pl_lock_volume_factor, 1); > > atomic_set(&pl->pl_grant_rate, 0); > >