]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: truncate: split huge page cache page to a non-zero order if possible
authorZi Yan <ziy@nvidia.com>
Mon, 3 Apr 2023 20:18:38 +0000 (16:18 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Wed, 5 Apr 2023 23:02:56 +0000 (16:02 -0700)
commitc1995efa2fb928d5f9c9467a4fab615a3e3acbde
tree057a5e75bbea40e6ef0d8f9ba52e8d0db1d70609
parentf649f5f4689440987a6c2f28cbf6b86c2400d7a3
mm: truncate: split huge page cache page to a non-zero order if possible

To minimize the number of pages after a huge page truncation, we do not
need to split it all the way down to order-0.  The huge page has at most
three parts, the part before offset, the part to be truncated, the part
remaining at the end.  Find the greatest common divisor of them to
calculate the new page order from it, so we can split the huge page to
this order and keep the remaining pages as large and as few as possible.

Link: https://lkml.kernel.org/r/20230403201839.4097845-7-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>
mm/truncate.c