Skip to content

RFC Split huge pages to any lower order pages.

Zi Yan linux-kselftest linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 29 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6mm: huge_memory: add new debugfs interface to trigger split huge page on any page range.mm/huge_memory.c mm/internal.h mm/migrate.c +2 more+262 -14 replies
2/6mm: memcg: make memcg huge page split support any order split.include/linux/memcontrol.h mm/huge_memory.c mm/memcontrol.c+6 -54 replies
3/6mm: page_owner: add support for splitting to any order in split page_owner.include/linux/page_owner.h mm/huge_memory.c mm/page_alloc.c +1 more+9 -815 replies
4/6mm: thp: add support for split huge page to any lower order pages.include/linux/huge_mm.h mm/huge_memory.c mm/swap.c+63 -244 replies
5/6mm: truncate: split thp to a non-zero order if possible.mm/truncate.c+20 -22 replies
6/6mm: huge_memory: enable debugfs to split huge pages to any order.mm/huge_memory.c tools/testing/selftests/vm/split_huge_page_test.c+105 -100 replies

Reviews trailers per patch

2 of 6 patches have a Reviewed-by or Acked-by.

PatchRalph CampbellRoman Gushchin
1/6
2/6R-b A-b
3/6R-b
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/6] Split huge pages to any lower order pages.

From: Zi Yan <[email protected]>

Hi all,

With Matthew's THP in pagecache patches[1], we will be able to handle any size pagecache THPs, but currently split_huge_page can only split a THP to order-0 pages. This can easily erase the benefit of having pagecache THPs, when operations like truncate might want to keep pages larger than order-0. In response, here is the patches to add support for splitting a THP to any lower order pages. In addition, this patchset prepares for my PUD THP patchset[2], since splitting a PUD THP to multiple PMD THPs can be handled by split_huge_page_to_list_to_order function added by this patchset, which reduces a lot of redundant code without just replicating split_huge_page for PUD THP.

The patchset is on top of Matthew's pagecache/next tree[3].

To ease the tests of split_huge_page functions, I added a new debugfs interface at <debugfs>/split_huge_pages_in_range_pid, so developers can split THPs in a given range from a process with the given pid by writing "<pid>,<vaddr_start>,<vaddr_end>,<to_order>" to the interface. I also added a new test program to test 1) split PMD THPs, 2) split pagecache THPs to any lower order, and 3) truncating a pagecache THP to a page with a lower order.

Suggestions and comments are welcome. Thanks.

[1] https://lore.kernel.org/linux-mm/[email protected]/
[2] https://lore.kernel.org/linux-mm/[email protected]/
[3] https://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads/next

Zi Yan (6):
mm: huge_memory: add new debugfs interface to trigger split huge page
on any page range.
mm: memcg: make memcg huge page split support any order split.
mm: page_owner: add support for splitting to any order in split
page_owner.
mm: thp: add support for split huge page to any lower order pages.
mm: truncate: split thp to a non-zero order if possible.
mm: huge_memory: enable debugfs to split huge pages to any order.

 include/linux/huge_mm.h                       |   8 +
 include/linux/memcontrol.h                    |   5 +-
 include/linux/page_owner.h                    |   7 +-
 mm/huge_memory.c                              | 177 ++++++++++--
 mm/internal.h                                 |   1 +
 mm/memcontrol.c                               |   4 +-
 mm/migrate.c                                  |   2 +-
 mm/page_alloc.c                               |   2 +-
 mm/page_owner.c                               |   6 +-
 mm/swap.c                                     |   1 -
 mm/truncate.c                                 |  22 +-
 tools/testing/selftests/vm/Makefile           |   1 +
 .../selftests/vm/split_huge_page_test.c       | 255 ++++++++++++++++++
 13 files changed, 453 insertions(+), 38 deletions(-)
 create mode 100644 tools/testing/selftests/vm/split_huge_page_test.c

--
2.28.0