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 D44F93F822B for ; Mon, 24 Aug 2026 10:33:55 +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=1787567637; cv=none; b=hoFRJGuml1ZNrsOJbhEggl3Q/RQS570uWyOMWezbD1Ius6uyqc6M05+8sabN0cXszYkBbJ0AILi0Z40AxCwOFsEYin+Qt+bvUle+BptbuzugtrunvztImrazwdb/lYRGAmAPVw2+UMq2o1LAdqWiHBYiOJ95Lg1v04f19rsKBHI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787567637; c=relaxed/simple; bh=CxyYeNtNLGE82mYwKfRh6fZCqV/IRrwKER1s2b0QR/I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G3TzFTLTrSN8yGspaWBkz/DbFKv8yzHPttAqLSL69AjtHvXoz72gFbTiNjrissXNqa2vCQBWXW5dPt2OCckzCUBoYys6Kuro4SrplPOdbwbRMc9t32jtvJy1nrRr55t6J085A4H5XemLzSTCLxcmF7bxEcr+82EQCsRHxei41BI= 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=STMg/htY; 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="STMg/htY" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-84faf87d19dso3228829b3a.3 for ; Mon, 24 Aug 2026 03:33:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787567635; x=1788172435; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=SiENGpsX2j0F/tjaU2o6XIRs97I21bYZzZ0hoz2JLa8=; b=STMg/htYnq+baU7v7Ih0qL4MJSR0Wduknd+vAsCS0gTmfbAy15dpR8FOD1uCAe/+Nn tLF486FOS9kEib71Adwg6BDfpAYSlFSCVRkbgBfrCW2vIJ+jWBlDQYbG9R0mY3CySswX U3p+HIr/5jMvkAX932fRrSDHCUfbp0iQGS0QP/kEDodVQcnlLsl/rsCkQhYBQPdW1i6i KpS+WDdoiVoO6xnlj4WWJ51sREZr+3vQBIRYJopTbVG0h6p6PJz5fW0VON1WhYWDV5U/ ryv3wLVLtaG4vMr0eFVlr4Vy08SKu0upFOe7VWKZeSW3q4xlOlZmv337YkP/vKHmpA4L RGeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787567635; x=1788172435; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=SiENGpsX2j0F/tjaU2o6XIRs97I21bYZzZ0hoz2JLa8=; b=DVSc6R7CW3sBS+8MWn2g1wSpSQPpxedFWC9i0H1BReojWm9RoTTYV9nnWAaM2mI+jk wwLdf/80E9LHW5mGpnfjCAyaZGFsWVVjjunG2fhk0odhOya+AZyrHxBMzCVy092AXbI0 j0I9689agV69WtnOcX0Uq2sRZ3X0C8K8rs0tcku8Zn+BUIbcz6LG74ukpYcaMTOj5Huq TNKsdFh93N0J4rYNKtWWIso72QkkT9+I5N/iYuH046c6bPgn3j14VLPQwISgFoJsyAuO 1cR7q+zuZIwG7C3nO8IZDK4qGWpoAkCYuSE2XSzf4bXWIELn6O5ZG+mZEZOmWpiDnw3T EFjA== X-Forwarded-Encrypted: i=1; AHgh+RpU1Mkj8vwm371EGqa97NTTJVFR9anI4GmULvKbmctPNNNYAKzd/5lon1t7sK9lMcpozVr+XgM8qRABZGg=@vger.kernel.org X-Gm-Message-State: AFuF++kn6/PYLM52ugTTMVAcgXiIFQu2nBNtL24zgnli1v+b0vV8sr1k 1VyJXM70CCYcVBlddy4ok/h9qI6K6lU/WzF8ywqQ22o4fR+6sw1InKzW X-Gm-Gg: AR+sD1116V7lEhhoz7xBsDdSk7SilS16qIxOONHu749vT8ebSk76/eUguWFeSL/7kAC KLa+XJKJE1n51T8ikK0JOUEwj7uyh+6418Y7x23JD39m2xRWNzD/yNSf7zYiJL6F7AlTfg8qZ3q f/aA/a72aXozp/tkWzYSd/ZeZfMQfKh5jezS0jO78thVjuZcb6eaLxLWCQUXdRS8DWOHnsYHOvO xKalB7HZ5M3NIZSyKiwgspEzVdNs2fl4OFqaQu3IMDi3AIKJNN4pvrdOW0iC1Tj4t6BEV6jYjs/ oxjOzhYmG7sRjMiTBTysLqsUDP6MqLr5yiPQ0Ew3h66yBJ9B4lv6Mg0MNIh6GXZibfHpZqV+DaR lYOEleo3a5oQm3Zx/RYRlK6Gc9KNSWSj6XrhoanbzXNWHsHtyVlv8D+AOfxsIsQQMPRlfwq6N3M 4X4i6tvFhytE1Pu6aXX/eN0SMtRet+eiH1Y2iN87xdasLLETMnhzT43hIepchVCDdhYXK8ilZxW oSGEEArg4/EgTsuELYsBbUd X-Received: by 2002:a05:6a00:2e0f:b0:842:7296:dba with SMTP id d2e1a72fcca58-8520b983fdbmr26075032b3a.7.1787567635125; Mon, 24 Aug 2026 03:33:55 -0700 (PDT) Received: from qiwenjie-ThinkCentre-M760t.mioffice.cn ([43.224.245.241]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8520f14abb3sm1805081b3a.45.2026.08.24.03.33.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 03:33:54 -0700 (PDT) From: Wenjie Qi X-Google-Original-From: Wenjie Qi To: jaegeuk@kernel.org, chao@kernel.org Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org, qiwenjie@xiaomi.com, qwjhust@gmail.com Subject: [PATCH v3 0/2] f2fs: enable buffered RWF_DONTCACHE Date: Mon, 24 Aug 2026 18:33:45 +0800 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260820071438.695893-1-qiwenjie@xiaomi.com> References: <20260820071438.695893-1-qiwenjie@xiaomi.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series enables buffered RWF_DONTCACHE on F2FS for sustained one-pass streaming writes, where retaining the written data can displace more useful cache. Patch 1 records whether an F2FS write bio contains dropbehind folios, keeps normal and dropbehind folios in separate bios in the IPU and OPU paths, and defers unsafe dropbehind completion through the existing sbi->wq. Patch 2 passes FGP_DONTCACHE to the F2FS buffered write folio lookup and advertises FOP_DONTCACHE. Tests were run on a Xiaomi phone with 10.7 GiB of kernel-visible memory, running Android 16 and Linux 6.12.69 with 4 KiB pages. /data used F2FS. The performance test wrote exactly 64 GiB per run at 4 KiB, 8 KiB, 16 KiB, 32 KiB, 64 KiB, 128 KiB, 256 KiB, 512 KiB, and 1 MiB. Two counterbalanced rounds ran ascending normal-first and descending dontcache-first. Values below are equal-weight means of both runs; N=2. The pwritev2() writer models the streaming workload; it does not show that an unchanged Android application already issues RWF_DONTCACHE. Android remained active with displays off. Each run started after a cache reset and at least 120 seconds of cooldown. Throughput and one-second kswapd0/global-memory samples cover the write loop. Write-loop throughput was: normal MiB/s dontcache MiB/s I/O r1 r2 mean r1 r2 mean change 4K 946.28 935.74 941.01 291.36 309.31 300.33 -68.08% 8K 1077.05 1105.84 1091.45 477.79 479.79 478.79 -56.13% 16K 1126.84 1118.49 1122.67 643.40 652.06 647.73 -42.30% 32K 1150.62 1036.33 1093.48 762.24 751.45 756.84 -30.79% 64K 1144.80 1163.82 1154.31 852.11 851.19 851.65 -26.22% 128K 1166.29 1162.84 1164.57 867.47 865.05 866.26 -25.61% 256K 1153.61 1172.78 1163.19 895.53 885.33 890.43 -23.45% 512K 1173.61 1197.34 1185.48 903.09 903.01 903.05 -23.82% 1M 1126.22 1154.59 1140.41 850.74 894.60 872.67 -23.48% Average kswapd0 CPU and average global Cached were: I/O kswapd0 CPU, normal/DC Cached MiB, normal/DC 4K 18.45% / 0% 4830.15 / 686.56 8K 21.60% / 0% 4862.35 / 591.48 16K 22.75% / 0% 4905.47 / 625.07 32K 22.05% / 0% 4945.82 / 561.59 64K 23.46% / 0% 4920.77 / 639.78 128K 23.16% / 0% 4971.37 / 693.26 256K 23.68% / 0% 4956.93 / 668.60 512K 24.25% / 0% 4972.22 / 663.92 1M 22.01% / 0% 5001.09 / 705.30 Other global memory means were: MemAvailable MiB Dirty MiB Writeback MiB I/O normal / DC normal / DC normal / DC 4K 6513.08 / 6382.31 640.48 / 33.93 37.94 / 0.09 8K 6560.77 / 6529.33 690.89 / 43.57 40.84 / 0.54 16K 6587.46 / 6519.94 789.16 / 62.67 61.58 / 4.64 32K 6571.95 / 6566.74 850.48 / 69.14 67.69 / 9.24 64K 6600.64 / 6559.89 856.97 / 134.28 59.60 / 16.19 128K 6627.03 / 6465.10 873.68 / 137.57 60.57 / 41.50 256K 6615.58 / 6541.09 885.98 / 158.15 61.25 / 29.57 512K 6625.52 / 6534.41 900.65 / 139.07 63.65 / 30.35 1M 6677.09 / 6539.89 909.70 / 187.56 51.58 / 33.46 Active(file) MiB Inactive(file) MiB I/O normal / DC normal / DC 4K 279.57 / 264.13 4426.38 / 183.12 8K 262.32 / 260.97 4472.62 / 182.19 16K 392.09 / 252.95 4392.78 / 195.82 32K 254.30 / 248.44 4554.18 / 187.34 64K 252.73 / 244.94 4545.40 / 267.28 128K 322.02 / 243.95 4530.63 / 298.91 256K 245.47 / 240.02 4586.64 / 303.92 512K 254.75 / 232.05 4591.17 / 288.27 1M 238.88 / 233.64 4638.81 / 341.00 Dontcache left zero target-file pages resident at every size. Normal retained about 1.19--1.24 million pages. Normal runs incurred roughly 15.6 million kswapd page scans and steals per run, while dontcache recorded zero. Direct scan and allocation-stall deltas were zero in both modes. A controlled explicit-dontcache model issued 64 KiB writes for 120 seconds at 64, 128, and 256 MiB/s. Both modes sustained all three rates in both rounds with no final schedule overrun. The late-write ratio was 0.02%--0.41%, and maximum schedule lag was 3.3--6.0 ms. Dontcache left zero target pages resident. This was a controlled model, not an unchanged Xiaomi application. Read tests were unpaced. Each run started with zero source pages resident and read the same 64 GiB file sequentially at full speed with preadv2(). Results from two counterbalanced rounds were: I/O normal MiB/s dontcache MiB/s change 4K 1825.50 1695.10 -7.14% 8K 1901.46 1847.96 -2.81% 16K 1941.60 1872.55 -3.56% 32K 1960.95 1905.92 -2.81% 64K 1951.35 1886.54 -3.32% 128K 1960.03 1915.82 -2.26% 256K 1976.01 1900.41 -3.83% 512K 1973.31 1911.24 -3.15% 1M 2230.91 2007.82 -10.00% Dontcache left zero source pages resident in all measured read runs. The normal-I/O control showed read-throughput differences of +0.67%, -0.90%, and -2.58%, and write-throughput differences of -1.75%, +0.33%, and +2.33%, at 4 KiB, 64 KiB, and 1 MiB respectively. Changes since v2: - keep the implementation unchanged; - add paced-write, unpaced-read, and normal-I/O control results. Wenjie Qi (2): f2fs: complete dropbehind write bios in safe task context f2fs: enable buffered RWF_DONTCACHE fs/f2fs/data.c | 59 ++++++++++++++++++++++++++++++++++++++++---------- fs/f2fs/file.c | 2 +- 2 files changed, 49 insertions(+), 12 deletions(-) -- 2.43.0