Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1666292rdb; Sat, 3 Feb 2024 17:25:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFtHkDn9JyjhV3ZFFlDp4BgP3KjD4uOBk0huxCSksxGh+ajhXn/Az2XBAQg1Xleck6G8GNt X-Received: by 2002:a05:6214:1bca:b0:68c:5aec:a777 with SMTP id m10-20020a0562141bca00b0068c5aeca777mr4294732qvc.15.1707009944703; Sat, 03 Feb 2024 17:25:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707009944; cv=pass; d=google.com; s=arc-20160816; b=A9NmROOvxIBF02kFldvqReoGYGUcORTKVx6tZJKYs1Jft0/eRMm+j3e+IsEaK2B/uL roEYExBlDGgmjQWFeOTKTVc0tM0SjtMzVhBVBi+c5ZApMfbaogA8uiAuiZ/UPww9gYsl 2qI1rBE5hGHvdn1Krmyqr5GRIriXQkeGsqTLl/+3tYeQFItYPEmb7mRJjVT2oqdhrgQN 7KRNSEz4bNubRRpm4lLGVOd4PuOMAU66rRbxB/uiW2GekGwT4UZYeCMpuKb8Ky4qGD9M C3LH13JySRHg99jhkfc8phrCo1mmvoljJykAmytyL9GWH0945Kl5aKPWDAyqJ8jw9kGF YOEg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=ESMkuwLFJYZTQtf0DBQRmReJtN7pWWJU6zwXLVVs/ls=; fh=KROBW2nG0GBZiWNNNT/9ST/bqLlQol9QqWSdnaAafVk=; b=KCs/P2TY1k7KnkNjwz5mbJgW5YuL0db3AsaGdrk3rKRTOSV0H5ZdNBjPegl1wKLgDe eAYHe5vf9maghzY9MPrk6C5igDGY+OG4fZiSXusrKhet9koOZeSzEvRB7p+p09HlkMhO IHNOaQPJOkEuasu4zKl8vIQhh9Dy4GhIKJSA1RmUM5p5O4vYrtR/Ai6XeGkpRL8C098v 2yS071tFk19QQCWHLNUgIUJycjNapzOYl1GOwnw3gCrooxqWW2Sf+GCIX0mj6SmVW5tj QGiok/DBDFYDqEqcWUxDWYxsgNmBVQIExuJh94RF1HxKBGg7Wr/Z7Jrq5mK3ogeEgV8u v6oQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YJ1YLtbE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51361-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51361-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXQL4CelN5v4edYkN//9tM1amHBYJQlHPQSyovLtR4Z1V/Qak+xJ1Rjn3mYxYECyeUtdgfqZq3GhSxcXKrnjetU2X2LzeK6hod5EVY0nA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dc3-20020a056214174300b006852904842csi5406271qvb.276.2024.02.03.17.25.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Feb 2024 17:25:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-51361-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YJ1YLtbE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-51361-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-51361-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 731E91C21C01 for ; Sun, 4 Feb 2024 01:25:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 406DA4C9F; Sun, 4 Feb 2024 01:25:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YJ1YLtbE" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 52AA44685 for ; Sun, 4 Feb 2024 01:25:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707009938; cv=none; b=gy05NPv8kHNj8cBXZNUb4HhqAo4ce97yH+yLpLURkv0fc5whFDb8dxqV/aocjGGLGP4FQ9qcIWlEIeRtBIXCvC2Qxo6MHNVBY8YWLxL4E+PA99CUIkZrs7ssiLQYbCgle/HFaGd+dtoxPZIn75WqmCcEIdM6o8GSPMFjSedakSk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707009938; c=relaxed/simple; bh=WpCKdFqw5IN67E9Y7z93QSOdWPaN4BD4TFaa8l4D5Cg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ITb/Sm/1v08W4/IcUNopqKB7KwJw/WfwFSyNnzTGitg3jCYYDy3LD87OcPIoJ2X2ntKREUv4NVjZU6UKWMpZ4Tq6PjWMDlhbq3MVH0KZLQtKh4yWBTdzEbtgEyrTis0imow0oHcrSb5AqQAr12m+smsPaAGaOxLnP1qoXi2f6eQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YJ1YLtbE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 12A17C433F1; Sun, 4 Feb 2024 01:25:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707009937; bh=WpCKdFqw5IN67E9Y7z93QSOdWPaN4BD4TFaa8l4D5Cg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=YJ1YLtbEjbSL8fHL6KuOOJ19qt+pEVsMiNLRnXQVX4SgbdzaW/Hm4snK4xa/04qVB ra+AxK7FGu4DCkMO+BmyKcXe2KMrjctXyYPSWO3mjQtePhoUJ5lWBxvfWB4tbvO92W w3FE4GBUHADVCQV9GSU6Z/S7Wel6pr9DzsosDE9voRfeLnvJqIE8kX13ZHYKGuy64T Hj+AbKwJV8oidFDQm6kZ5WS5kiElX3gZ/gJVGgD5t6H9o67f4P8Z0/s9qwCASPbWCw vzf+FVEHUJ4rg9nuMZd4xmWwHrE4mUMEVz6S8ejbC4Wb9bQiiJ6XguDH0jwfP/7Azy gJfKBGUeRsJJw== Message-ID: Date: Sun, 4 Feb 2024 09:25:31 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] f2fs: sysfs: support gc_io_aware Content-Language: en-US To: liujinbao1 , jaegeuk@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, liujinbao1 References: <5a4cdc020f19e136e79f9d0b6ca2adf2879db888.1706859367.git.liujinbao1@xiaomi.corp-partner.google.com> From: Chao Yu In-Reply-To: <5a4cdc020f19e136e79f9d0b6ca2adf2879db888.1706859367.git.liujinbao1@xiaomi.corp-partner.google.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024/2/2 19:22, liujinbao1 wrote: > From: liujinbao1 AFAIK, this account is only used for interaction between google and its partner, I guess you can use xiaomi's email address instead? > > Currently, IO can only be ignored when GC_URGENT_HIGH is set, > and the default algorithm used for GC_URGENT_HIGH is greedy. > It gives a way to enable/disable IO aware feature for background > gc, so that we can tune background gc more precisely. e.g. > force to disable IO aware and choose more suitable algorithm > if there are large number of dirty segments. > > Signed-off-by: liujinbao1 Ditto, > > changes of v2: Improve the patch according to Chao's suggestions Trivial thing, it's better not include above line in commit message. Thanks, > > --- > Documentation/ABI/testing/sysfs-fs-f2fs | 6 ++++++ > fs/f2fs/gc.c | 3 ++- > fs/f2fs/gc.h | 1 + > fs/f2fs/sysfs.c | 9 +++++++++ > 4 files changed, 18 insertions(+), 1 deletion(-) > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs > index 36c3cb547901..47f02fa471fe 100644 > --- a/Documentation/ABI/testing/sysfs-fs-f2fs > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs > @@ -16,6 +16,12 @@ Contact: "Namjae Jeon" > Description: Controls the default sleep time for gc_thread. Time > is in milliseconds. > > +What: /sys/fs/f2fs//gc_io_aware > +Date: January 2024 > +Contact: "Jinbao Liu" > +Description: It controls to enable/disable IO aware feature for background gc. > ++ By default, the value is 1 which indicates IO aware is on. > + > What: /sys/fs/f2fs//gc_idle > Date: July 2013 > Contact: "Namjae Jeon" > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > index 309da3d0faff..0b75d37acc63 100644 > --- a/fs/f2fs/gc.c > +++ b/fs/f2fs/gc.c > @@ -109,7 +109,7 @@ static int gc_thread_func(void *data) > goto next; > } > > - if (!is_idle(sbi, GC_TIME)) { > + if (gc_th->io_aware && !is_idle(sbi, GC_TIME)) { > increase_sleep_time(gc_th, &wait_ms); > f2fs_up_write(&sbi->gc_lock); > stat_io_skip_bggc_count(sbi); > @@ -182,6 +182,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi) > gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME; > gc_th->max_sleep_time = DEF_GC_THREAD_MAX_SLEEP_TIME; > gc_th->no_gc_sleep_time = DEF_GC_THREAD_NOGC_SLEEP_TIME; > + gc_th->io_aware = true; > > gc_th->gc_wake = false; > > diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h > index 28a00942802c..51d6ad26b76a 100644 > --- a/fs/f2fs/gc.h > +++ b/fs/f2fs/gc.h > @@ -41,6 +41,7 @@ struct f2fs_gc_kthread { > unsigned int min_sleep_time; > unsigned int max_sleep_time; > unsigned int no_gc_sleep_time; > + bool io_aware; > > /* for changing gc mode */ > bool gc_wake; > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > index 417fae96890f..e8d5667cfddd 100644 > --- a/fs/f2fs/sysfs.c > +++ b/fs/f2fs/sysfs.c > @@ -516,6 +516,13 @@ static ssize_t __sbi_store(struct f2fs_attr *a, > return count; > } > > + if (!strcmp(a->attr.name, "gc_io_aware")) { > + if (t > 1) > + return -EINVAL; > + *ui = t ? true : false; > + return count; > + } > + > if (!strcmp(a->attr.name, "migration_granularity")) { > if (t == 0 || t > sbi->segs_per_sec) > return -EINVAL; > @@ -906,6 +913,7 @@ GC_THREAD_RW_ATTR(gc_urgent_sleep_time, urgent_sleep_time); > GC_THREAD_RW_ATTR(gc_min_sleep_time, min_sleep_time); > GC_THREAD_RW_ATTR(gc_max_sleep_time, max_sleep_time); > GC_THREAD_RW_ATTR(gc_no_gc_sleep_time, no_gc_sleep_time); > +GC_THREAD_RW_ATTR(gc_io_aware, io_aware); > > /* SM_INFO ATTR */ > SM_INFO_RW_ATTR(reclaim_segments, rec_prefree_segments); > @@ -1061,6 +1069,7 @@ static struct attribute *f2fs_attrs[] = { > ATTR_LIST(gc_min_sleep_time), > ATTR_LIST(gc_max_sleep_time), > ATTR_LIST(gc_no_gc_sleep_time), > + ATTR_LIST(gc_io_aware), > ATTR_LIST(gc_idle), > ATTR_LIST(gc_urgent), > ATTR_LIST(reclaim_segments),