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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D59CC48BEB for ; Fri, 16 Feb 2024 10:06:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D9626B0087; Fri, 16 Feb 2024 05:06:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 689CE6B0089; Fri, 16 Feb 2024 05:06:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 551966B008C; Fri, 16 Feb 2024 05:06:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 452B76B0087 for ; Fri, 16 Feb 2024 05:06:34 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 11C40C0423 for ; Fri, 16 Feb 2024 10:06:34 +0000 (UTC) X-FDA: 81797237508.16.5416867 Received: from mout-p-102.mailbox.org (mout-p-102.mailbox.org [80.241.56.152]) by imf04.hostedemail.com (Postfix) with ESMTP id 06BB740010 for ; Fri, 16 Feb 2024 10:06:31 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=u7RYAcMw; spf=pass (imf04.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708077992; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qQCyd4+RAcgA/+yjcYQaov3P2x0z6l0myi/TdMlnugk=; b=zJZYH85GQgQz3bHIFdHlt/0WZI692RG3PLfwVhIED7U1dg6VfOAWIJdRZf2eo2u/4qDD8h 0u2p1FmXxVKE4sk6F1alsfAJlss3itw20uf4TSNykm+0YJpPjwiC0dCxySmLFeBrEMGi9+ hu5Pr6eglvbepO6W4roq9Mbmegvv634= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708077992; a=rsa-sha256; cv=none; b=SKaGD63nE6Q4/ZFkrlqnkk0dkrNa8dOre/djCv26tVPwQShx3Esk3EPHEA1PEAagsNT3xl LT6yNazXPKbO1mSCSOWJ6n3NxkMZQRRzPADEQl93EWLQL/IWSnwIAKu/n8Cmd/HFaPf9Uq I5BgrbSqdlbL3o8f0mZG4Tf1q2hu5U4= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=pankajraghav.com header.s=MBO0001 header.b=u7RYAcMw; spf=pass (imf04.hostedemail.com: domain of kernel@pankajraghav.com designates 80.241.56.152 as permitted sender) smtp.mailfrom=kernel@pankajraghav.com; dmarc=none Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-102.mailbox.org (Postfix) with ESMTPS id 4TbndZ0N6tz9snk; Fri, 16 Feb 2024 11:06:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pankajraghav.com; s=MBO0001; t=1708077986; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qQCyd4+RAcgA/+yjcYQaov3P2x0z6l0myi/TdMlnugk=; b=u7RYAcMwMqlhw5zr5alamnS4sLimwlabotnFFKAHV8A+2O03mKdQq4oIOC3ETVYPrh86Vn 2hA0XKH/bp0takB2EwV1l1+5w3scKiB6LQHdSRMpvgo2xrtBUcprCKYYEGyELVqFJ/Gkmi pAhNUBVorXF18ltMbFmUEYHkVMPYLSHEuIFICGYm9udRgqjmDUSZ0pKxzXPONsny67XcMh TfMI3GWVSMS60ODyuS/mrdbD6I17s1VJFcuApk0fSpB4IK+VwczFuY/PzjOMcP/Ih+AnMp HAnj71mnz4vp5IxANH6iKU+ItyJydsjxkMLT0exQ+fPHouHPDmslbm6uWjDmpQ== Date: Fri, 16 Feb 2024 11:06:20 +0100 From: "Pankaj Raghav (Samsung)" To: Zi Yan Cc: linux-mm@kvack.org, "Matthew Wilcox (Oracle)" , David Hildenbrand , Yang Shi , Yu Zhao , "Kirill A . Shutemov" , Ryan Roberts , Michal =?utf-8?Q?Koutn=C3=BD?= , Roman Gushchin , Zach O'Keefe , Hugh Dickins , Mcgrof Chamberlain , Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org, gost.dev@samsung.com Subject: Re: [PATCH v4 0/7] Split a folio to any lower order folios Message-ID: References: <20240213215520.1048625-1-zi.yan@sent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240213215520.1048625-1-zi.yan@sent.com> X-Rspamd-Queue-Id: 06BB740010 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: bzocyo1zxniky4s6ofbfhqrck7csag7z X-HE-Tag: 1708077991-433460 X-HE-Meta: U2FsdGVkX1+bSigPsHr2BqLjhYUqgnmqiz1k9dM+OIaOznv74xYvYoWKQoR+W35oTAU/OWEFKN7d0vRMA4y2TV4C34V+ll78BnLuM54sBKqnHvMXPXpwySIo3RTbN9TgjTDokvjcETde0C8WYkhw0FjRgPALbk6rzo3Fc+aTMIbxr4FXcPJuzQZT4nmAdVPxPFm50DJefW0vDJbwWS7Otrbl95dP/YpUd+vcaEXVU8+xWb6lIVLZF7d1iB+4p/+eRsBn7VnbTRUO+vBfv7NEDNHhLEZGfDfXWa2FX2PZ6D9aoFUms9CZfNPvME8Av/oknOwg81PEBZMLjcWAmzVq822D7VzaCgEkOAV9EPv2yIfQV3j9VOkm4C2uTu5kbogi8yabPdhyfyUWSRokTwSU5qK6Q7nKpCdacEZu22hs3PK5+7UzyXxDaKFnY5wYLAi9y9BW6TpP7ClPTwhMEcp9F1oQCXWVlTP3lFfLlICEINyHgnDgpZfFMVq+IeVonZcYuK3YaVuF0C4at/tqBLmJRACQNxlMV6VCYQ03q4YohP4wkudTgSzEdoa3k8K4ojFzLXOBt7V0RJ5eb+ufJI3BT7FnjSwOJM33cPk5IJ32W/G8jKV5nMdZpfCWh8vJEQNElSGn6/ahASyn8p74tSNJB9Wu7YDI4MHV4+S05gEF1KINJIZ+vVKjMCo2BfST7ZKtrirMFUrb5uBj7h6XeEE/OnY8jnCqJCEDVacpSpyh96/bp9RbLDi5KCiWTUYF1cdRhngKO9+c02Ug4W4+exRTkZta78y9oTBA/XDTvgZqtCGQIZg4XGsDVNULSmaP/BNk2d+zjCCOgaLZsoVIuaAMzBRXnaW4/i8nQdTjl3BwXlRdw2pQnCDltkJTylQs1kaKe2AMEOeLhku6I7iwxLS8hYAcOEEL7qiVzq8G15tZ2N95N3PpmcqOqU9eWD3llPDN3oJYpWLAVj0NrV7/PZG YQL8MxAq jcKEDJvPvRTWq8C2MqD9DBIvTMiT5je/9YLkJoLa6UWEzrPRLuhTeS7FxFxmWJsu/GiMwKdzZ1GiNg2ASMNHMem+nZgmK1vjPFH6Es6ReZM43j1cMTNsCe+VCqq54WjLfQeYYW9ODyD3mh01hbq3lZRGCJFweXoKpClybjKTStE3s1d9Jui84REOFHbQO7oAbtp/BxN7KN0irYShvjNNaiEn/hQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi Zi Yan, On Tue, Feb 13, 2024 at 04:55:13PM -0500, Zi Yan wrote: > From: Zi Yan > > Hi all, > > File folio supports any order and multi-size THP is upstreamed[1], so both > file and anonymous folios can be >0 order. Currently, split_huge_page() > only splits a huge page to order-0 pages, but splitting to orders higher than > 0 is going to better utilize large folios. In addition, Large Block > Sizes in XFS support would benefit from it[2]. This patchset adds support for > splitting a large folio to any lower order folios and uses it during file > folio truncate operations. I added your patches on top of my patches, but removed patch 6 and I added this instead: diff --git a/mm/truncate.c b/mm/truncate.c index 725b150e47ac..dd07e2e327a8 100644 --- a/mm/truncate.c +++ b/mm/truncate.c @@ -239,7 +239,8 @@ bool truncate_inode_partial_folio(struct folio *folio, loff_t start, loff_t end) folio_invalidate(folio, offset, length); if (!folio_test_large(folio)) return true; - if (split_folio(folio) == 0) + if (split_folio_to_order(folio, + mapping_min_folio_order(folio->mapping)) == 0) return true; if (folio_test_dirty(folio)) return false; I ran genric/476 fstest[1] with SOAK_DURATION set to 360 seconds. This test uses fstress to do a lot of writes, truncate operations, etc. I ran this on XFS with **64k block size on a 4k page size system**. I recorded the vm event for split page and this was the result I got: Before your patches: root@debian:~/xfstests# cat /proc/vmstat | grep split thp_split_page 0 thp_split_page_failed 5819 After your patches: root@debian:~/xfstests# cat /proc/vmstat | grep split thp_split_page 5846 thp_split_page_failed 20 Your patch series definitely helps with splitting the folios while still maintaining the min_folio_order that LBS requires. We are still discussing how to quantify this benefit in terms of some metric with this support. If you have some ideas here, let me know. I will run the whole xfstests tonight to check for any regressions. -- Pankaj [1] https://github.com/kdave/xfstests/blob/master/tests/generic/476