]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: thp: split huge page to any lower order pages
authorZi Yan <ziy@nvidia.com>
Mon, 3 Apr 2023 20:18:37 +0000 (16:18 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 5 Apr 2023 23:02:56 +0000 (16:02 -0700)
commitf649f5f4689440987a6c2f28cbf6b86c2400d7a3
tree0fd827d3dbfa271c441b8b709060acada1b4d1f8
parent677980d56a416d428eda2655586b2a362bd588fe
mm: thp: split huge page to any lower order pages

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.

It has many uses, like minimizing the number of pages after truncating a
huge pagecache page.  For anonymous THPs, we can only split them to
order-0 like before until we add support for any size anonymous THPs.

Link: https://lkml.kernel.org/r/20230403201839.4097845-6-zi.yan@sent.com
Signed-off-by: Zi Yan <ziy@nvidia.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Koutný <mkoutny@suse.com>
Cc: Roman Gushchin <roman.gushchin@linux.dev>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Yu Zhao <yuzhao@google.com>
Cc: Zach O'Keefe <zokeefe@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/huge_mm.h
mm/huge_memory.c