[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <FD2D17E1-5B18-4342-8692-FCE2FA774895@nvidia.com>
Date: Thu, 07 Mar 2024 09:58:34 -0500
From: Zi Yan <ziy@...dia.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-mm@...ck.org,
"\"Pankaj Raghav (Samsung)\"" <kernel@...kajraghav.com>,
Zi Yan <ziy@...dia.com>, "\"Matthew Wilcox (Oracle)\"" <willy@...radead.org>,
David Hildenbrand <david@...hat.com>, Yang Shi <shy828301@...il.com>,
Yu Zhao <yuzhao@...gle.com>,
"\"Kirill A . Shutemov\"" <kirill.shutemov@...ux.intel.com>,
Ryan Roberts <ryan.roberts@....com>,
"Michal Koutný" <mkoutny@...e.com>,
Roman Gushchin <roman.gushchin@...ux.dev>,
"\"Zach O'Keefe\"" <zokeefe@...gle.com>, Hugh Dickins <hughd@...gle.com>,
Luis Chamberlain <mcgrof@...nel.org>, linux-kernel@...r.kernel.org,
cgroups@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-kselftest@...r.kernel.org, Dan Carpenter <dan.carpenter@...aro.org>
Subject: Re: [PATCH v5 7/8] mm: thp: split huge page to any lower order pages
On 26 Feb 2024, at 15:55, Zi Yan wrote:
> From: Zi Yan <ziy@...dia.com>
>
> To split a THP to any lower order pages, we need to reform THPs on
> subpages at given order and add page refcount based on the new page
> order. Also we need to reinitialize page_deferred_list after removing
> the page from the split_queue, otherwise a subsequent split will
> see list corruption when checking the page_deferred_list again.
>
> Note: Anonymous order-1 folio is not supported because _deferred_list,
> which is used by partially mapped folios, is stored in subpage 2 and an
> order-1 folio only has subpage 0 and 1. File-backed order-1 folios are
> fine, since they do not use _deferred_list.
>
> Signed-off-by: Zi Yan <ziy@...dia.com>
> ---
> include/linux/huge_mm.h | 21 +++++---
> mm/huge_memory.c | 110 +++++++++++++++++++++++++++++++---------
> 2 files changed, 99 insertions(+), 32 deletions(-)
Hi Andrew,
Can you fold the patch below into this patch 7? It is based on the discussion
with Dan Carpenter at https://lore.kernel.org/linux-mm/7dda9283-b437-4cf8-ab0d-83c330deb9c0@moroto.mountain/.
It prevents invalid new_order input from causing unexpected outcome of
split_huge_page_to_list_to_order(). Especially in patch 8, new_order can come
from debugfs without any restriction. I will send another fixup to
patch 8 to check new_order from debugfs.
Thanks.
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index a81a09236c16..57fca7bffd20 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -3052,6 +3052,9 @@ int split_huge_page_to_list_to_order(struct page *page, struct list_head *list,
VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
VM_BUG_ON_FOLIO(!folio_test_large(folio), folio);
+ if (new_order >= folio_order(folio))
+ return -EINVAL;
+
/* Cannot split anonymous THP to order-1 */
if (new_order == 1 && folio_test_anon(folio)) {
VM_WARN_ONCE(1, "Cannot split to order-1 folio");
--
Best Regards,
Yan, Zi
Download attachment "signature.asc" of type "application/pgp-signature" (855 bytes)
Powered by blists - more mailing lists