Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4712189imm; Mon, 17 Sep 2018 20:26:44 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZGzaY/2R7vsqpD5LdMKamjGB3o2MFoT7e5alU8Dsb0odd5WiujXvIMKaw2/KbH6NQ1KnGL X-Received: by 2002:a62:e008:: with SMTP id f8-v6mr28669737pfh.208.1537241204203; Mon, 17 Sep 2018 20:26:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537241204; cv=none; d=google.com; s=arc-20160816; b=egTdGlbt0fCjuxdttbA6J5y++yWwWehtwq53Mk0bOJhH8nHPur7ckIRh3Sq2k5l4gq pdvJrSAq1HKFd8IhQ/nSNekNjrAUGsT/+DyBYzho2C/5Kpyml5VTVk0Vg7iQ08A0Bf7g 82KoVITGhcyFbj6hkvr5JO4hQKvpklPzB2USGNqQLIjf9yU3V16X5VmhIzxEC4eB+2ds MgUhUqA+mIfT9Bs8o/UnsD1lx5k9E2uq8g2j+CCwsCRuhLYrpoxwhI2hp3Fy8Yi1RsRx +RygXnJvMR4bxXMz58MVzb+ievcgGh8PtvNYitZ7TwtV8XYgJUrB8a/zvSSPGn7Cj+L5 ZRKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature; bh=iigW+Ki2xw7Wggs+Ki9wShs7OmSBE4XDgLZbB7JJ+vA=; b=hatRqVH2JS4F+0JSiiI+W7CCvIISVi0VuKnMfw4RpwreIoX14Fy/EzO1qDRBgrzdV5 UfQhcxdDb9Gl2NIt+ACxjKhLK3BPbVQBpgE9w240+7z8Fr2inhOaxsAonC+dLLU/MCYC 0tA8gYpXe2drXuTf+MN5Lbk5/JScll8OrmT4gIpvY57P4hQxlb9f/9XpuvbUm0FN9QXl ShdXmhnLR0ae+r7XEnPC9DZ2UKS6ULjonQhrOvxnIEbHO48NFof3i6IZKJ4jHrssQfVc lhQvnGp1e68d3s2n7/eAtMoVeOo1kKVZJUoxVgRU0Lcxop5eplp8jFNKcmRU4FfdeWd9 cfdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=HIvzisEH; dkim=pass header.i=@codeaurora.org header.s=default header.b=oZpYndrS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 184-v6si17581069pfe.249.2018.09.17.20.26.28; Mon, 17 Sep 2018 20:26:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=HIvzisEH; dkim=pass header.i=@codeaurora.org header.s=default header.b=oZpYndrS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729172AbeIRIz4 (ORCPT + 99 others); Tue, 18 Sep 2018 04:55:56 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:57966 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726531AbeIRIz4 (ORCPT ); Tue, 18 Sep 2018 04:55:56 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8639D60818; Tue, 18 Sep 2018 03:25:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537241123; bh=fwGCsl1I5panZhDORbCJOlmqxKlxfQ56G3fefvk2a6Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HIvzisEH7xE6/0lrJ9IjQS2N6Uzki9BKy87IOxdYjcVyd/hkvO5uAj5FdFTSo0uoR B6fGlGN/NpdeawRvkaZIrA2pCRLzbspepPDymmwW5mkg05LLeGEvzt7Bd8X8vx/+TM IjowQikLMvaPy3EpSIYHpbNOrNYx2U6X0dlbnK+4= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: stummala@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 64D5260558; Tue, 18 Sep 2018 03:25:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1537241122; bh=fwGCsl1I5panZhDORbCJOlmqxKlxfQ56G3fefvk2a6Y=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=oZpYndrSUxZHfwXyu38PwvMZhjaaAwqJ83OvJc1ebBLR/b2nVT94pl+YDyTWK1MQl rVv+kUoimx+LjEbimGQRpDSJduDok45sbcUf3tu9rtCP+uVVQpNp3yQH4dqDHrqXnR /r/Ijpgo8YBevcdAMIL0Eb7l9HCPEAJf2gQA1CwI= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 64D5260558 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=stummala@codeaurora.org Date: Tue, 18 Sep 2018 08:55:16 +0530 From: Sahitya Tummala To: Jaegeuk Kim Cc: Chao Yu , linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] f2fs: add new idle interval timing for discard and gc paths Message-ID: <20180918032516.GD22939@codeaurora.org> References: <1537169458-30361-1-git-send-email-stummala@codeaurora.org> <20180918013039.GD79604@jaegeuk-macbookpro.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180918013039.GD79604@jaegeuk-macbookpro.roam.corp.google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 17, 2018 at 06:30:39PM -0700, Jaegeuk Kim wrote: > On 09/17, Sahitya Tummala wrote: > > This helps to control the frequency of submission of discard and > > GC requests independently, based on the need. > > > > Suggested-by: Chao Yu > > Signed-off-by: Sahitya Tummala > > --- > > v3: > > -don't change gc thread wait_ms in this patch > > -Use the existing function f2fs_time_over() to handle this > > -change f2fs_get_wait_time() to f2fs_time_to_wait() > > > > Documentation/ABI/testing/sysfs-fs-f2fs | 17 ++++++++++++++++- > > fs/f2fs/f2fs.h | 28 +++++++++++++++++++++++++--- > > fs/f2fs/gc.c | 2 +- > > fs/f2fs/segment.c | 14 +++++--------- > > fs/f2fs/super.c | 2 ++ > > fs/f2fs/sysfs.c | 5 +++++ > > 6 files changed, 54 insertions(+), 14 deletions(-) > > > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs > > index 94a24ae..3ac4177 100644 > > --- a/Documentation/ABI/testing/sysfs-fs-f2fs > > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs > > @@ -121,7 +121,22 @@ What: /sys/fs/f2fs//idle_interval > > Date: January 2016 > > Contact: "Jaegeuk Kim" > > Description: > > - Controls the idle timing. > > + Controls the idle timing for all paths other than > > + discard and gc path. > > + > > +What: /sys/fs/f2fs//discard_idle_interval > > +Date: September 2018 > > +Contact: "Chao Yu" > > +Contact: "Sahitya Tummala" > > +Description: > > + Controls the idle timing for discard path. > > + > > +What: /sys/fs/f2fs//gc_idle_interval > > +Date: September 2018 > > +Contact: "Chao Yu" > > +Contact: "Sahitya Tummala" > > +Description: > > + Controls the idle timing for gc path. > > > > What: /sys/fs/f2fs//iostat_enable > > Date: August 2017 > > diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h > > index 88b8d50..41e00d3 100644 > > --- a/fs/f2fs/f2fs.h > > +++ b/fs/f2fs/f2fs.h > > @@ -1095,6 +1095,8 @@ enum { > > enum { > > CP_TIME, > > REQ_TIME, > > + DISCARD_TIME, > > + GC_TIME, > > MAX_TIME, > > }; > > > > @@ -1352,11 +1354,31 @@ static inline void f2fs_update_time(struct f2fs_sb_info *sbi, int type) > > static inline bool f2fs_time_over(struct f2fs_sb_info *sbi, int type) > > { > > unsigned long interval = sbi->interval_time[type] * HZ; > > + unsigned long last_time; > > > > - return time_after(jiffies, sbi->last_time[type] + interval); > > + if (type == CP_TIME) > > + last_time = sbi->last_time[CP_TIME]; > > + else > > + last_time = sbi->last_time[REQ_TIME]; > > Why can't we use just this? > > return time_after(jiffies, sbi->last_time[type] + interval); > There is no sbi_->last_time[discard_time] and sbi->last_time[gc_time]. Only sbi->interval_time[discard_time] and sbi->interval_time[gc_time] is defined to determine the idle interval time since the last request time, separately for these two paths. > > + > > + return time_after(jiffies, last_time + interval); > > +} > > + > > +static inline unsigned int f2fs_time_to_wait(struct f2fs_sb_info *sbi, > > + int type) > > +{ > > + unsigned long interval = sbi->interval_time[type] * HZ; > > + unsigned int wait_ms = 0; > > + long delta; > > + > > + delta = (sbi->last_time[REQ_TIME] + interval) - jiffies; > > + if (delta > 0) > > + wait_ms = jiffies_to_msecs(delta); > > + > > + return wait_ms; > > } > > > > -static inline bool is_idle(struct f2fs_sb_info *sbi) > > +static inline bool is_idle(struct f2fs_sb_info *sbi, int type) > > { > > struct block_device *bdev = sbi->sb->s_bdev; > > struct request_queue *q = bdev_get_queue(bdev); > > @@ -1365,7 +1387,7 @@ static inline bool is_idle(struct f2fs_sb_info *sbi) > > if (rl->count[BLK_RW_SYNC] || rl->count[BLK_RW_ASYNC]) > > return false; > > > > - return f2fs_time_over(sbi, REQ_TIME); > > + return f2fs_time_over(sbi, type); > > } > > > > /* > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > > index 5c8d004..49e2328 100644 > > --- a/fs/f2fs/gc.c > > +++ b/fs/f2fs/gc.c > > @@ -83,7 +83,7 @@ static int gc_thread_func(void *data) > > if (!mutex_trylock(&sbi->gc_mutex)) > > goto next; > > > > - if (!is_idle(sbi)) { > > + if (!is_idle(sbi, GC_TIME)) { > > increase_sleep_time(gc_th, &wait_ms); > > mutex_unlock(&sbi->gc_mutex); > > goto next; > > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c > > index 187c848..67cf7e4 100644 > > --- a/fs/f2fs/segment.c > > +++ b/fs/f2fs/segment.c > > @@ -511,7 +511,7 @@ void f2fs_balance_fs_bg(struct f2fs_sb_info *sbi) > > else > > f2fs_build_free_nids(sbi, false, false); > > > > - if (!is_idle(sbi) && > > + if (!is_idle(sbi, REQ_TIME) && > > (!excess_dirty_nats(sbi) && !excess_dirty_nodes(sbi))) > > return; > > > > @@ -1311,7 +1311,7 @@ static unsigned int __issue_discard_cmd_orderly(struct f2fs_sb_info *sbi, > > if (dc->state != D_PREP) > > goto next; > > > > - if (dpolicy->io_aware && !is_idle(sbi)) { > > + if (dpolicy->io_aware && !is_idle(sbi, DISCARD_TIME)) { > > io_interrupted = true; > > break; > > } > > @@ -1371,7 +1371,7 @@ static int __issue_discard_cmd(struct f2fs_sb_info *sbi, > > f2fs_bug_on(sbi, dc->state != D_PREP); > > > > if (dpolicy->io_aware && i < dpolicy->io_aware_gran && > > - !is_idle(sbi)) { > > + !is_idle(sbi, DISCARD_TIME)) { > > io_interrupted = true; > > break; > > } > > @@ -1564,8 +1564,6 @@ 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(); > > > > @@ -1602,10 +1600,8 @@ static int issue_discard_thread(void *data) > > __wait_all_discard_cmd(sbi, &dpolicy); > > wait_ms = dpolicy.min_interval; > > } else if (issued == -1){ > > - delta = (sbi->last_time[REQ_TIME] + interval) - jiffies; > > - if (delta > 0) > > - wait_ms = jiffies_to_msecs(delta); > > - else > > + wait_ms = f2fs_time_to_wait(sbi, DISCARD_TIME); > > + if (!wait_ms) > > wait_ms = dpolicy.mid_interval; > > } else { > > wait_ms = dpolicy.max_interval; > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > > index 3106da1..2f67948 100644 > > --- a/fs/f2fs/super.c > > +++ b/fs/f2fs/super.c > > @@ -2463,6 +2463,8 @@ static void init_sb_info(struct f2fs_sb_info *sbi) > > sbi->dir_level = DEF_DIR_LEVEL; > > sbi->interval_time[CP_TIME] = DEF_CP_INTERVAL; > > sbi->interval_time[REQ_TIME] = DEF_IDLE_INTERVAL; > > + sbi->interval_time[DISCARD_TIME] = DEF_IDLE_INTERVAL; > > + sbi->interval_time[GC_TIME] = DEF_IDLE_INTERVAL; > > clear_sbi_flag(sbi, SBI_NEED_FSCK); > > > > for (i = 0; i < NR_COUNT_TYPE; i++) > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > > index 81c0e53..0afe99c 100644 > > --- a/fs/f2fs/sysfs.c > > +++ b/fs/f2fs/sysfs.c > > @@ -407,6 +407,9 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a, > > F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, dir_level, dir_level); > > F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, cp_interval, interval_time[CP_TIME]); > > F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, idle_interval, interval_time[REQ_TIME]); > > +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, discard_idle_interval, > > + interval_time[DISCARD_TIME]); > > +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_idle_interval, interval_time[GC_TIME]); > > F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, iostat_enable, iostat_enable); > > F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, readdir_ra, readdir_ra); > > F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, gc_pin_file_thresh, gc_pin_file_threshold); > > @@ -460,6 +463,8 @@ static ssize_t f2fs_feature_show(struct f2fs_attr *a, > > ATTR_LIST(dirty_nats_ratio), > > ATTR_LIST(cp_interval), > > ATTR_LIST(idle_interval), > > + ATTR_LIST(discard_idle_interval), > > + ATTR_LIST(gc_idle_interval), > > ATTR_LIST(iostat_enable), > > ATTR_LIST(readdir_ra), > > ATTR_LIST(gc_pin_file_thresh), > > -- > > Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. > > Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project. -- -- Sent by a consultant of the Qualcomm Innovation Center, Inc. The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.