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 8BEA9C83F17 for ; Fri, 18 Jul 2025 21:50:15 +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: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: Subject:MIME-Version:Message-ID:Date:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=8RjMQKEtevp9U2MExovyyakZsWPxMu8S7JEBQdBGPoI=; b=kr/swma39GxOi+ELNB6sq0ZOEL /x83f0Jrn9/XSbOtl7kUhVyJ319H+B/85J35omj7Jq94XQzVQ/Fpla9Bc2qwE9aXBi7vAsViVTW9o FMQOltd4eVeLIVJzjp3iC1pL4n3fV76ZHKEw/4IO6wfBlV4lGCEYS5KQl/2hN0Q33qbs=; 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 1ucsy7-0008SC-5t; Fri, 18 Jul 2025 21:50:15 +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 1ucsy6-0008S5-FW for linux-f2fs-devel@lists.sourceforge.net; Fri, 18 Jul 2025 21:50:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:Message-ID: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=vkMUMoA1UivzBLhqZ+bzZIQ12HlKF5zuA3g0fn0IJSg=; b=QoGTCqkl3Wnd1SS7Uwf8/QQVlx 7fWztPiIr15UUrhTFMzXjU8Wm0nryCDuJLlNv6cgjB/DBkLrlDMV0jMfvgWXP49xOVSVMKKHJGZDi dlaOW/mh2jHbqfpUdj2A1ocuNKpvO/voNhNGlk3FeCxn9bbMNyyuo2OSmCJOsZXoFFts=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:Message-ID:Date:Subject:Cc:To:From :Sender:Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=vkMUMoA1UivzBLhqZ+bzZIQ12HlKF5zuA3g0fn0IJSg=; b=d xlNB4Yui2fd6sQMbqd/lwQwNdibtO+4AZZEtKophMmqk0YOcrAcT6VYLx9CkBe9lT3b/aQWLxteVu QpRAl3uGmTGDRnHZV1Ucq9a8+s1zcBLKZmFlMpNtZi7wLBC7dkXMFqZojBTxlgi1lDCkHrcLhjS+f rKxX+M0/qKcIpoN0=; Received: from mail-pl1-f170.google.com ([209.85.214.170]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1ucsy6-0006S1-3C for linux-f2fs-devel@lists.sourceforge.net; Fri, 18 Jul 2025 21:50:14 +0000 Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-23649faf69fso22921855ad.0 for ; Fri, 18 Jul 2025 14:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752875408; x=1753480208; darn=lists.sourceforge.net; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vkMUMoA1UivzBLhqZ+bzZIQ12HlKF5zuA3g0fn0IJSg=; b=UzEReV9soKC7tY5wGMpcX+K17y2sAXCFVLMYykdpfPJ/vgny7XFjvbkVJI9gO0Y0HG ip4cHZUmVtaW0JpK2mS3m19TVSax8kafexETI+9uwFw+U/rUJJ3L/xxULkZx5Ri1ETiH 5TTnv6e2gg4i4rWu/7/H34Gb1qhwtfb3tZDb+Kbtg1voq9nm/dimP8RA9oc1bSWnvlmv ipBczIyONq9WSlhyLBVTzgYOk0iORAsdsBGtOhnHmIl2Qpudpg5Zv9btz5SJ3c31AACP iHTNZeMC7gRZOlCfJnVpYY8jLMSAbH6xsJHv0KlRfF6o02N0cZWgKcGrWqa5vxrHxxG/ 5miw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752875408; x=1753480208; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vkMUMoA1UivzBLhqZ+bzZIQ12HlKF5zuA3g0fn0IJSg=; b=hMWrddwbEvM88dLnNRwV45sB1AhGTw9pYaDZ12/DbRTdiN1Mx1mG1y20uNMYXgMPKu pJSYks8TZSVvWxK4zwHtxwl29HzbyT+QxsIpb1yVYHVr/PKGdnxdkNymeDrW3G/7F22B IIEEtEGTs65aQMlUV5R5cdFIH7/JzZhpMU6k5nl1yPEe3Eh9o8fzM+UJbOkesE+yzvED WvXj+iNxZFLuCFXymjJ/B77B2pPtFxhoajCxAn7SQyuomSqZP4GZ8hC+qjwjuhwO6hpE lYw2pb1h1yb8CElY1I9JtYJe8uZDpHTR7EpvKeer1WLzUcUqcu7xnTf0sj3zK+ApIKsj X3tA== X-Forwarded-Encrypted: i=1; AJvYcCVWkIRFDStRZ9KmyPnZBHDEt+uzSCdFUFMQBLOROUo8We08525TdlkF3m7vUdQTEbB/Gyn5nsRKF5w+isXKK4tR@lists.sourceforge.net X-Gm-Message-State: AOJu0YwfXiMsm11ahZhC8uVhMCnQsFFtgw8PegCzrmKPTgT5lht1brPT XAnlzOmfP3FSn1R81fkQkPyLbgq3/eRLLTteqDi3IKyNRy40SrEMPmUk X-Gm-Gg: ASbGncs5ao/KZV8DqxnKqN17NmRWZmgIy3WHd/biXbBm+2GVal9fSvIvk4uEu98iQz/ FNXyA2Pqiw7U/kC5gGPhHt0fxxyn8Pj9FngFf1HRvdEcuQ1CPbkHdLNM0aWoyKktJ7hF7pH5OLu kCH86TpgaceNzzo/fmTPz0+Via4Z9ohDXi1Kw2C9f3pDcW+V+YclkEnCrB2FVVClSqS99RqPHJU fyqKQ2tv2LGRNS1JA/uuTn/vzcD5FmV86OCkeI40ipErpnPK+onoG+iYTI7ZLemy6Nx9Neq79GO xU6Y4xSob0Y02coCMbSaAaXMGcHcc62N+IYhjWQQ3jkTS4GDCyRksviPdFxRCG/KF5dZXTr4oZM uN/GZmfJBybP10CHmfoae/C83qOKlLMNTuqL7+ILfrYe0Y7MD1fyuXvKpt+UU9mXWDlqWX8ml6g FGHljEL8OVW1tngQ== X-Google-Smtp-Source: AGHT+IFVZlkWS40fPv2xMRzPGNdRd58qU6Vif92LpMuLo3svyO4zJnooHC4ZMgfo8z7+w3Goti4Eaw== X-Received: by 2002:a17:902:ef49:b0:235:779:edfd with SMTP id d9443c01a7336-23e25759752mr173198155ad.39.1752875408325; Fri, 18 Jul 2025 14:50:08 -0700 (PDT) Received: from daehojeong-desktop.mtv.corp.google.com ([2a00:79e0:2e14:7:902e:59ec:cd2a:fc00]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6d2dd6sm18156305ad.164.2025.07.18.14.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jul 2025 14:50:07 -0700 (PDT) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Date: Fri, 18 Jul 2025 14:50:03 -0700 Message-ID: <20250718215003.2283009-1-daeho43@gmail.com> X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog MIME-Version: 1.0 X-Headers-End: 1ucsy6-0006S1-3C Subject: [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: , Cc: Daeho Jeong Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net 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; + } + + 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), -- 2.50.0.727.gbf7dc18ff4-goog _______________________________________________ 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 mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5869421D3F4 for ; Fri, 18 Jul 2025 21:50:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752875410; cv=none; b=h9i2IDZI5DJkGET1nebb0JnQZul+bS/Cg7dXxwkK/dEJfROug2/6FWP1c0FNvjYstmDN9srqGbjq73klM6dW4zXx6iYYIbUapxbmkewVpl+it/qdTMk48XElH6Kxzz6sJIOdE8piKmkJUJAEvnRy+POakKG0khGeKN2aU9hXr9o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752875410; c=relaxed/simple; bh=AUkUsf/KFg817SmSNb973yO/40vdrf1JQ3SgHxi6d6M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=A5dx/dYyBAacbYFiMUEbGIGXoeDmTJ3wgiyPLOHQuV9nCtEqxW0H+6lYWM6A0VhCUmp7ZbiEOQ9P/QxsLtBOoa0NQSWXkd8YIYPdEGOvJ/i6mKj08Ljmm5x/vC0jeRIoUHnVCgiLfDKkm14wlDENmdfOHvAdGg2QNEW09jGJSbY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=H5sbT42m; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="H5sbT42m" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-74b50c71b0aso1504013b3a.0 for ; Fri, 18 Jul 2025 14:50:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1752875408; x=1753480208; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=vkMUMoA1UivzBLhqZ+bzZIQ12HlKF5zuA3g0fn0IJSg=; b=H5sbT42moAAosFwDZVHzPx6mHXHcQzmWVXD6Iy91pzg5u0I9vWZmbH/tSk5Jcp4/D5 SZKt7nZz3Ox5oaR8IpdzFW2q0he956NXNPpEMWbQXsX9y6cMr49JpUspZ2MWJyqZCvb8 L7RR1y9qD04luq4fdtTzFzDnj4keOxpflrOaqQCf6SSX88DcpvwJt939T4Nkdl0NQjvJ SVSfcECIrnG+dFY/H4JCY3afc9PKekBA/JzAZK8uupN5rdxGXWrc0wFrVWBJJs7CCIFh Uu1Ds38pCCHG9VujJkPWQeKBWT+SUPLVDap/242fRETWKX0Knaxxsuv8gGkh5yWV4aCX iiFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752875408; x=1753480208; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=vkMUMoA1UivzBLhqZ+bzZIQ12HlKF5zuA3g0fn0IJSg=; b=p3uTDAuPz1tNpRWyZjCKDbRyIIg6wzKzN4U/BvOqUtTPj7e+qN/A+sq/7ZpOjOWHnH CdFycMNshrbjH8TsX6hTDMV4voOXi2N38TXq0AYjLgH1btny2Mq9lsI6xtOiqxRopU8v jF2bxC+BohvyRbWYSoNuMfdJANaxIS/PS3mVMz/Dz25vAE9d2jP28GkO+ghU/v6/7XmS 5olanKYFhOgVzmZA/m8jipTIoaHwNvIKIXnHcbejggoqN6Mx+gR30aIxyxfHw/rbjDQB vZzVQWBAVpcypRzrrJ2whcMazlnGYnKnpkC0ifg8nalwmZZLxQOpngGCQmkRwX1U4Kh2 kpVQ== X-Gm-Message-State: AOJu0YxydTNvrKqy/rT0WPm0Vn24uew37pyJPOjfTnWVg5upuJQ1eFZt h+Cs6XKfXBqiGUkH6N7xMgSpdlPdhWirlWogFXbLo/iNEnfbytjCMYzSN+qi2A== X-Gm-Gg: ASbGncublDw9gejXVpKtKEuonTTW5dQyp9N9jaG9DhL1HpNcAzeHEMZCfcCt8MNACWb hwTXdKmpxPlvi/qgRx81QWLEUd7yBNPx8YYuuM406gIYsRSoJ1h8xEEQifhHzlpDvn6ZABzqMKt FpIFd6asVNYhNiCZgxqNgZ0fh7o3v/njIBEVwLKYX9tIGmjus3d+91SworNpF/qi3xAoY/z6fjx htTkxefbWvfziWMjb6LnEBrT3emB9b/nhU0v3lOcGNGIvwUZc99MtZDxL8ki+sFbcHKFo5Mj2hV zZz5JsMI5vGQtCV6jFOBWUTiqNnXwPzEZhHbggirv87n5Hd1R2TBAh8JSJ2UQSBOHVxXGxWSil0 ktWBuxs+EMZB9WKj1RKLfZr/ZF2BRMV1gHfO27Pc1UHidSOUBbY6tCLmezrYr5SaqAmq6ceyPSa pRFGUlM3tGoVr25A== X-Google-Smtp-Source: AGHT+IFVZlkWS40fPv2xMRzPGNdRd58qU6Vif92LpMuLo3svyO4zJnooHC4ZMgfo8z7+w3Goti4Eaw== X-Received: by 2002:a17:902:ef49:b0:235:779:edfd with SMTP id d9443c01a7336-23e25759752mr173198155ad.39.1752875408325; Fri, 18 Jul 2025 14:50:08 -0700 (PDT) Received: from daehojeong-desktop.mtv.corp.google.com ([2a00:79e0:2e14:7:902e:59ec:cd2a:fc00]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-23e3b6d2dd6sm18156305ad.164.2025.07.18.14.50.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 18 Jul 2025 14:50:07 -0700 (PDT) From: Daeho Jeong To: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, kernel-team@android.com Cc: Daeho Jeong Subject: [PATCH v2] f2fs: add gc_boost_gc_greedy sysfs node Date: Fri, 18 Jul 2025 14:50:03 -0700 Message-ID: <20250718215003.2283009-1-daeho43@gmail.com> X-Mailer: git-send-email 2.50.0.727.gbf7dc18ff4-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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; + } + + 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), -- 2.50.0.727.gbf7dc18ff4-goog