mbox series

[0/7] Split huge pages to any lower order pages and selftests.

Message ID 20201119160605.1272425-1-zi.yan@sent.com
Headers show
Series Split huge pages to any lower order pages and selftests. | expand

Message

Zi Yan Nov. 19, 2020, 4:05 p.m. UTC
From: Zi Yan <ziy@nvidia.com>

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.

To help the tests of splitting huge pages, 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) splitting PMD THPs, 2) splitting PTE-mapped THPs,
3) splitting pagecache THPs to any lower order, 4) truncating a pagecache
THP to a page with a lower order, and 5) punching holes in a pagecache THP to
cause splitting THPs to lower order THPs.

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

* Patch 1 is cherry-picked from Matthew's recent xarray fix [4] just to make sure
  Patch 3 to 7 can run without problem. I let Matthew decide how it should get
  picked up.
* Patch 2 is self-contained and can be merged if it looks OK.

Comments and/or suggestions are welcome.

ChangeLog
===