From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sahitya Tummala Subject: Re: [PATCH] f2fs: fix unnecessary periodic wakeup of discard thread when dev is busy Date: Sun, 2 Sep 2018 16:04:11 +0530 Message-ID: <20180902103411.GE12489@codeaurora.org> References: <1535708366-11318-1-git-send-email-stummala@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1fwPi5-0007fT-GR for linux-f2fs-devel@lists.sourceforge.net; Sun, 02 Sep 2018 10:34:25 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1fwPi3-0072uM-8D for linux-f2fs-devel@lists.sourceforge.net; Sun, 02 Sep 2018 10:34:25 +0000 Content-Disposition: inline In-Reply-To: List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Chao Yu Cc: Jaegeuk Kim , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net On Sun, Sep 02, 2018 at 04:52:40PM +0800, Chao Yu wrote: > On 2018/8/31 17:39, Sahitya Tummala wrote: > > When dev is busy, discard thread wake up timeout can be aligned with the > > exact time that it needs to wait for dev to come out of busy. This helps > > to avoid unnecessary periodic wakeups and thus save some power. > > > > Signed-off-by: Sahitya Tummala > > --- > > fs/f2fs/segment.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > > index 8bcbb50..df14030 100644 > > --- a/fs/f2fs/segment.c > > +++ b/fs/f2fs/segment.c > > @@ -1379,6 +1379,8 @@ static int issue_discard_thread(void *data) > > struct discard_policy dpolicy; > > unsigned int wait_ms = DEF_MIN_DISCARD_ISSUE_TIME; > > int issued; > > + unsigned long interval = sbi->interval_time[REQ_TIME] * HZ; > > + long delta; > > > > set_freezable(); > > > > @@ -1410,7 +1412,11 @@ static int issue_discard_thread(void *data) > > __wait_all_discard_cmd(sbi, &dpolicy); > > wait_ms = dpolicy.min_interval; > > } else if (issued == -1){ > > - wait_ms = dpolicy.mid_interval; > > + delta = (sbi->last_time[REQ_TIME] + interval) - jiffies; > > I agree that we need to consider power consumption. One more consideration is > that discard thread may need different submission frequency comparing to garbage > collection thread, maybe a little fast, would it be better to split > sbi->interval_time[REQ_TIME] according to gc/discard type. > > How do you think? > > Thanks, > Thanks for the review. You mean when GC type is urgent? I see that for that case, the discard policy is changed to DPOLICY_FORCE, which sets dpolicy->io_aware as false and hence, cannot fall into this (issued == -1) case at all. > > + if (delta > 0) > > + wait_ms = jiffies_to_msecs(delta); > > + else > > + wait_ms = dpolicy.mid_interval; > > } else { > > wait_ms = dpolicy.max_interval; > > } > > -- -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot