From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6D6D7C83F17 for ; Mon, 28 Jul 2025 16:41:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:Cc: Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Subject:In-Reply-To:MIME-Version:References: Message-ID:To:Date:Sender:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eB4+LokCl/hVRJ2oUrDqXYJZt+s0gXKR5yVYI4Rr7ww=; b=XeSuaUp+jQuIq0Bwf6ZqY1bZ54 82Qhz1+o5h6JzdtJlX6X2QzPxIAXHa623o61f+hjc0AwLUqgrJbSqdqzbdwdMCh0ErGiIK/D1BhKN wX1VHeoziJAi5xQK7oe4vBrvmAxTZ4lg6+L1oynAIg8iQv6qXNTBplx6ksXddST+xx3Y=; Received: from [127.0.0.1] (helo=sfs-ml-3.v29.lw.sourceforge.com) by sfs-ml-3.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1ugQuS-0008W3-0l; Mon, 28 Jul 2025 16:41:08 +0000 Received: from [172.30.29.66] (helo=mx.sourceforge.net) by sfs-ml-3.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1ugQuQ-0008Vw-R0 for linux-f2fs-devel@lists.sourceforge.net; Mon, 28 Jul 2025 16:41:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=EWMmnAHZILuAtKhy59wZEN0nP1v5q1sxEai0uVHl+GE=; b=SxxZEk8Pop3nWImR5hFt5TP4tu iqq8XYGXFJGkE3PgPX0wZOVsjaQRUwvsgKSn9brsaSckhdJJOUvWojggH1MqpVYwZEs3664b8zNNC rUJX2KxtX6eThmk2NEjo/a/0nTEkSW01ZwATGMDtPj5Cb9ieYH7KGVIu9OT74/48/iRs=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=EWMmnAHZILuAtKhy59wZEN0nP1v5q1sxEai0uVHl+GE=; b=KQP7Nj9JUAwQdNqV/1XsnPBdmR WWLAsEUxP3jTlaFjLkDNRPu010YCuRl4RdFpAyw0bCgVAQmWfysLq0Zo4WkWKkqC8aDXD5iIpDZhi uYRVfZzEECGW5auZKr8fGAjMA8uBTYbNgm9/2T+ySPi9gNGJRye9ywfoeWOMYNXgGDRc=; Received: from nyc.source.kernel.org ([147.75.193.91]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1ugQuN-0007iS-4o for linux-f2fs-devel@lists.sourceforge.net; Mon, 28 Jul 2025 16:41:06 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 7B18CA53E30; Mon, 28 Jul 2025 16:40:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE75EC4CEE7; Mon, 28 Jul 2025 16:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753720852; bh=6z1DYzhMGiTdo3cVZNQD2vNNg+nClgICYhdNgBn9VzU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GX5Gkh5jlBFQCYiBggX4mknonD0WD8i3HVkm0di+4XvNUN+qaWfPm+pk4RDFWO2HD vuh2novJwVfZhmFFkXuk6IEHOcUOhu2XqOXjr27CY1T/02McewydnZNOlLP0b3BHYr /KPKwIDdpZ4Oh0aXOWL+Esc7jlOLytv5btHgI/EdEUoFetMEfkekaFqH9w8pYK6nwr 95epBjUykC7TqTGwgo8iqjtk4YTCSWHZa4uzhd4mAHz3RqkzeO9Sfg7/g7hE84XJ7e C1aHUm9hicQJBknQwQQXNlbf144VgzLqd+jOgkgwOW2SfaIH4z31TsYXIbzMQZfA1i hmKIKgB+3a3ZA== Date: Mon, 28 Jul 2025 16:40:50 +0000 To: Chao Yu Message-ID: References: <20250718215003.2283009-1-daeho43@gmail.com> <6c26bcaa-7a9d-4b30-b326-90395f55e155@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6c26bcaa-7a9d-4b30-b326-90395f55e155@kernel.org> X-Headers-End: 1ugQuN-0007iS-4o Subject: Re: [f2fs-dev] [PATCH v2] f2fs: add gc_boost_gc_greedy sysfs node X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Jaegeuk Kim via Linux-f2fs-devel Reply-To: Jaegeuk Kim Cc: Daeho Jeong , kernel-team@android.com, linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On 07/22, Chao Yu wrote: > On 7/19/25 05:50, Daeho Jeong wrote: > > From: Daeho Jeong > > > > Add this to control GC algorithm for boost GC. > > > > Signed-off-by: Daeho Jeong > > --- > > v2: use GC_GREEDY instead of 1 > > --- > > Documentation/ABI/testing/sysfs-fs-f2fs | 8 +++++++- > > fs/f2fs/gc.c | 3 ++- > > fs/f2fs/gc.h | 1 + > > fs/f2fs/sysfs.c | 16 ++++++++++++++++ > > 4 files changed, 26 insertions(+), 2 deletions(-) > > > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs > > index 931c1f63aa2e..2158055cd9d1 100644 > > --- a/Documentation/ABI/testing/sysfs-fs-f2fs > > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs > > @@ -866,6 +866,12 @@ What: /sys/fs/f2fs//gc_boost_gc_multiple > > Date: June 2025 > > Contact: "Daeho Jeong" > > Description: Set a multiplier for the background GC migration window when F2FS GC is > > - boosted. > > + boosted. the range should be from 1 to the segment count in a section. > > Default: 5 > > > > +What: /sys/fs/f2fs//gc_boost_gc_greedy > > +Date: June 2025 > > +Contact: "Daeho Jeong" > > +Description: Control GC algorithm for boost GC. 0: cost benefit, 1: greedy > > + Default: 1 > > + > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > > index de7e59bc0906..0d7703e7f9e0 100644 > > --- a/fs/f2fs/gc.c > > +++ b/fs/f2fs/gc.c > > @@ -141,7 +141,7 @@ static int gc_thread_func(void *data) > > FOREGROUND : BACKGROUND); > > > > sync_mode = (F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC) || > > - gc_control.one_time; > > + (gc_control.one_time && gc_th->boost_gc_greedy); > > > > /* foreground GC was been triggered via f2fs_balance_fs() */ > > if (foreground) > > @@ -198,6 +198,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi) > > gc_th->urgent_sleep_time = DEF_GC_THREAD_URGENT_SLEEP_TIME; > > gc_th->valid_thresh_ratio = DEF_GC_THREAD_VALID_THRESH_RATIO; > > gc_th->boost_gc_multiple = BOOST_GC_MULTIPLE; > > + gc_th->boost_gc_greedy = GC_GREEDY; > > > > if (f2fs_sb_has_blkzoned(sbi)) { > > gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME_ZONED; > > diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h > > index efa1968810a0..1a2e7a84b59f 100644 > > --- a/fs/f2fs/gc.h > > +++ b/fs/f2fs/gc.h > > @@ -69,6 +69,7 @@ struct f2fs_gc_kthread { > > unsigned int boost_zoned_gc_percent; > > unsigned int valid_thresh_ratio; > > unsigned int boost_gc_multiple; > > + unsigned int boost_gc_greedy; > > }; > > > > struct gc_inode_list { > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > > index b0270b1c939c..3a52f51ee3c6 100644 > > --- a/fs/f2fs/sysfs.c > > +++ b/fs/f2fs/sysfs.c > > @@ -824,6 +824,20 @@ static ssize_t __sbi_store(struct f2fs_attr *a, > > return count; > > } > > > > + if (!strcmp(a->attr.name, "gc_boost_gc_multiple")) { > > + if (t < 1 || t > SEGS_PER_SEC(sbi)) > > + return -EINVAL; > > + sbi->gc_thread->boost_gc_multiple = (unsigned int)t; > > + return count; > > + } > > This check should be in ("f2fs: add gc_boost_gc_multiple sysfs node"), right? Applied with the fix. > > Thanks, > > > + > > + if (!strcmp(a->attr.name, "gc_boost_gc_greedy")) { > > + if (t > GC_GREEDY) > > + return -EINVAL; > > + sbi->gc_thread->boost_gc_greedy = (unsigned int)t; > > + return count; > > + } > > + > > *ui = (unsigned int)t; > > > > return count; > > @@ -1051,6 +1065,7 @@ GC_THREAD_RW_ATTR(gc_no_zoned_gc_percent, no_zoned_gc_percent); > > GC_THREAD_RW_ATTR(gc_boost_zoned_gc_percent, boost_zoned_gc_percent); > > GC_THREAD_RW_ATTR(gc_valid_thresh_ratio, valid_thresh_ratio); > > GC_THREAD_RW_ATTR(gc_boost_gc_multiple, boost_gc_multiple); > > +GC_THREAD_RW_ATTR(gc_boost_gc_greedy, boost_gc_greedy); > > > > /* SM_INFO ATTR */ > > SM_INFO_RW_ATTR(reclaim_segments, rec_prefree_segments); > > @@ -1222,6 +1237,7 @@ static struct attribute *f2fs_attrs[] = { > > ATTR_LIST(gc_boost_zoned_gc_percent), > > ATTR_LIST(gc_valid_thresh_ratio), > > ATTR_LIST(gc_boost_gc_multiple), > > + ATTR_LIST(gc_boost_gc_greedy), > > ATTR_LIST(gc_idle), > > ATTR_LIST(gc_urgent), > > ATTR_LIST(reclaim_segments), > _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel From mboxrd@z Thu Jan 1 00:00:00 1970 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 9C652218ABD for ; Mon, 28 Jul 2025 16:40:52 +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=1753720853; cv=none; b=us94me/5bPU3PX3Z9VEBoqQ80xzPuBGP/Dqja7+q244MtW0hA2hzJG4LX4XOjB6iLkJhF4N5OZJeUSHm4Vm0o7rv3piJTFIhsopXMXVTcYAYug8mPXGAOcJcZqrrXM1mksQ1glawjap/QZdFnfnSBLvYdzf3mgNcb3UOUOhBGR0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753720853; c=relaxed/simple; bh=6z1DYzhMGiTdo3cVZNQD2vNNg+nClgICYhdNgBn9VzU=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gF4/3CpacMMeDsivYv1kDKnBVRve8JHbar3qY8xzsnQGEBIYWvXnDuTgSrP+p2YxC1KikZ3CjNSPgI96aMzfbcCwwyX3sHcHSb8T9o8nnPZTS9fei19lSBV9Ym5D29C9XHTWq8JQI1fm60TZFbNy/XT2kcJy2oLiyog20pgUgHo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GX5Gkh5j; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GX5Gkh5j" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE75EC4CEE7; Mon, 28 Jul 2025 16:40:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753720852; bh=6z1DYzhMGiTdo3cVZNQD2vNNg+nClgICYhdNgBn9VzU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GX5Gkh5jlBFQCYiBggX4mknonD0WD8i3HVkm0di+4XvNUN+qaWfPm+pk4RDFWO2HD vuh2novJwVfZhmFFkXuk6IEHOcUOhu2XqOXjr27CY1T/02McewydnZNOlLP0b3BHYr /KPKwIDdpZ4Oh0aXOWL+Esc7jlOLytv5btHgI/EdEUoFetMEfkekaFqH9w8pYK6nwr 95epBjUykC7TqTGwgo8iqjtk4YTCSWHZa4uzhd4mAHz3RqkzeO9Sfg7/g7hE84XJ7e C1aHUm9hicQJBknQwQQXNlbf144VgzLqd+jOgkgwOW2SfaIH4z31TsYXIbzMQZfA1i hmKIKgB+3a3ZA== Date: Mon, 28 Jul 2025 16:40:50 +0000 From: Jaegeuk Kim To: Chao Yu Cc: Daeho Jeong , linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com, Daeho Jeong Subject: Re: [f2fs-dev] [PATCH v2] f2fs: add gc_boost_gc_greedy sysfs node Message-ID: References: <20250718215003.2283009-1-daeho43@gmail.com> <6c26bcaa-7a9d-4b30-b326-90395f55e155@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6c26bcaa-7a9d-4b30-b326-90395f55e155@kernel.org> On 07/22, Chao Yu wrote: > On 7/19/25 05:50, Daeho Jeong wrote: > > From: Daeho Jeong > > > > Add this to control GC algorithm for boost GC. > > > > Signed-off-by: Daeho Jeong > > --- > > v2: use GC_GREEDY instead of 1 > > --- > > Documentation/ABI/testing/sysfs-fs-f2fs | 8 +++++++- > > fs/f2fs/gc.c | 3 ++- > > fs/f2fs/gc.h | 1 + > > fs/f2fs/sysfs.c | 16 ++++++++++++++++ > > 4 files changed, 26 insertions(+), 2 deletions(-) > > > > diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs > > index 931c1f63aa2e..2158055cd9d1 100644 > > --- a/Documentation/ABI/testing/sysfs-fs-f2fs > > +++ b/Documentation/ABI/testing/sysfs-fs-f2fs > > @@ -866,6 +866,12 @@ What: /sys/fs/f2fs//gc_boost_gc_multiple > > Date: June 2025 > > Contact: "Daeho Jeong" > > Description: Set a multiplier for the background GC migration window when F2FS GC is > > - boosted. > > + boosted. the range should be from 1 to the segment count in a section. > > Default: 5 > > > > +What: /sys/fs/f2fs//gc_boost_gc_greedy > > +Date: June 2025 > > +Contact: "Daeho Jeong" > > +Description: Control GC algorithm for boost GC. 0: cost benefit, 1: greedy > > + Default: 1 > > + > > diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c > > index de7e59bc0906..0d7703e7f9e0 100644 > > --- a/fs/f2fs/gc.c > > +++ b/fs/f2fs/gc.c > > @@ -141,7 +141,7 @@ static int gc_thread_func(void *data) > > FOREGROUND : BACKGROUND); > > > > sync_mode = (F2FS_OPTION(sbi).bggc_mode == BGGC_MODE_SYNC) || > > - gc_control.one_time; > > + (gc_control.one_time && gc_th->boost_gc_greedy); > > > > /* foreground GC was been triggered via f2fs_balance_fs() */ > > if (foreground) > > @@ -198,6 +198,7 @@ int f2fs_start_gc_thread(struct f2fs_sb_info *sbi) > > gc_th->urgent_sleep_time = DEF_GC_THREAD_URGENT_SLEEP_TIME; > > gc_th->valid_thresh_ratio = DEF_GC_THREAD_VALID_THRESH_RATIO; > > gc_th->boost_gc_multiple = BOOST_GC_MULTIPLE; > > + gc_th->boost_gc_greedy = GC_GREEDY; > > > > if (f2fs_sb_has_blkzoned(sbi)) { > > gc_th->min_sleep_time = DEF_GC_THREAD_MIN_SLEEP_TIME_ZONED; > > diff --git a/fs/f2fs/gc.h b/fs/f2fs/gc.h > > index efa1968810a0..1a2e7a84b59f 100644 > > --- a/fs/f2fs/gc.h > > +++ b/fs/f2fs/gc.h > > @@ -69,6 +69,7 @@ struct f2fs_gc_kthread { > > unsigned int boost_zoned_gc_percent; > > unsigned int valid_thresh_ratio; > > unsigned int boost_gc_multiple; > > + unsigned int boost_gc_greedy; > > }; > > > > struct gc_inode_list { > > diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c > > index b0270b1c939c..3a52f51ee3c6 100644 > > --- a/fs/f2fs/sysfs.c > > +++ b/fs/f2fs/sysfs.c > > @@ -824,6 +824,20 @@ static ssize_t __sbi_store(struct f2fs_attr *a, > > return count; > > } > > > > + if (!strcmp(a->attr.name, "gc_boost_gc_multiple")) { > > + if (t < 1 || t > SEGS_PER_SEC(sbi)) > > + return -EINVAL; > > + sbi->gc_thread->boost_gc_multiple = (unsigned int)t; > > + return count; > > + } > > This check should be in ("f2fs: add gc_boost_gc_multiple sysfs node"), right? Applied with the fix. > > Thanks, > > > + > > + if (!strcmp(a->attr.name, "gc_boost_gc_greedy")) { > > + if (t > GC_GREEDY) > > + return -EINVAL; > > + sbi->gc_thread->boost_gc_greedy = (unsigned int)t; > > + return count; > > + } > > + > > *ui = (unsigned int)t; > > > > return count; > > @@ -1051,6 +1065,7 @@ GC_THREAD_RW_ATTR(gc_no_zoned_gc_percent, no_zoned_gc_percent); > > GC_THREAD_RW_ATTR(gc_boost_zoned_gc_percent, boost_zoned_gc_percent); > > GC_THREAD_RW_ATTR(gc_valid_thresh_ratio, valid_thresh_ratio); > > GC_THREAD_RW_ATTR(gc_boost_gc_multiple, boost_gc_multiple); > > +GC_THREAD_RW_ATTR(gc_boost_gc_greedy, boost_gc_greedy); > > > > /* SM_INFO ATTR */ > > SM_INFO_RW_ATTR(reclaim_segments, rec_prefree_segments); > > @@ -1222,6 +1237,7 @@ static struct attribute *f2fs_attrs[] = { > > ATTR_LIST(gc_boost_zoned_gc_percent), > > ATTR_LIST(gc_valid_thresh_ratio), > > ATTR_LIST(gc_boost_gc_multiple), > > + ATTR_LIST(gc_boost_gc_greedy), > > ATTR_LIST(gc_idle), > > ATTR_LIST(gc_urgent), > > ATTR_LIST(reclaim_segments), >