From: Zi Yan <email@example.com> To: firstname.lastname@example.org, Matthew Wilcox <email@example.com>, "Kirill A . Shutemov" <firstname.lastname@example.org> Cc: Roman Gushchin <email@example.com>, Andrew Morton <firstname.lastname@example.org>, email@example.com, firstname.lastname@example.org, Yang Shi <email@example.com>, Michal Hocko <firstname.lastname@example.org>, John Hubbard <email@example.com>, Ralph Campbell <firstname.lastname@example.org>, David Nellans <email@example.com>, Zi Yan <firstname.lastname@example.org> Subject: [PATCH 0/7] Split huge pages to any lower order pages and selftests. Date: Thu, 19 Nov 2020 11:05:58 -0500 [thread overview] Message-ID: <email@example.com> (raw) From: Zi Yan <firstname.lastname@example.org> Hi all, With Matthew's THP in pagecache patches, 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, 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. * Patch 1 is cherry-picked from Matthew's recent xarray fix  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 === From RFC: 1. Fixed debugfs to handle splitting PTE-mapped THPs properly and added stats for split THPs. 2. Added a new test case for splitting PTE-mapped THPs. Each of the four PTEs points to a different subpage from four THPs and used kpageflags to check whether a PTE points to a THP or not (AnonHugePages from smap does not show PTE-mapped THPs). 3. mem_cgroup_split_huge_fixup() takes order instead of nr. 4. split_page_owner takes old_order and new_order instead of nr and new_order. 5. Corrected __split_page_owner declaration and fixed its implementation when splitting a THP to a new order. 6. Renamed left to remaining in truncate_inode_partial_page(). 7. Use VM_BUG_ON instead of WARN_ONCE when splitting a THP to the unsupported order-0 and splitting anonymous THPs to non-zero orders. 8. Added punching holes in a file as a new pagecache THP split test case, which uncovered an xarray bug.  https://email@example.com/  https://firstname.lastname@example.org/  https://git.infradead.org/users/willy/pagecache.git/shortlog/refs/heads/next  https://git.infradead.org/users/willy/xarray.git Matthew Wilcox (Oracle) (1): XArray: Fix splitting to non-zero orders 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: 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 | 10 +- lib/test_xarray.c | 26 +- lib/xarray.c | 4 +- mm/huge_memory.c | 219 ++++++-- mm/internal.h | 1 + mm/memcontrol.c | 6 +- mm/migrate.c | 2 +- mm/page_alloc.c | 2 +- mm/page_owner.c | 13 +- mm/swap.c | 1 - mm/truncate.c | 29 +- tools/testing/selftests/vm/.gitignore | 1 + tools/testing/selftests/vm/Makefile | 1 + .../selftests/vm/split_huge_page_test.c | 479 ++++++++++++++++++ 16 files changed, 742 insertions(+), 65 deletions(-) create mode 100644 tools/testing/selftests/vm/split_huge_page_test.c -- 2.28.0
next reply other threads:[~2020-11-19 16:07 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-11-19 16:05 Zi Yan [this message] 2020-11-19 16:05 ` [PATCH 1/7] XArray: Fix splitting to non-zero orders Zi Yan 2020-11-19 16:06 ` [PATCH 2/7] mm: huge_memory: add new debugfs interface to trigger split huge page on any page range Zi Yan 2020-11-19 16:06 ` [PATCH 3/7] mm: memcg: make memcg huge page split support any order split Zi Yan 2020-11-19 16:06 ` [PATCH 4/7] mm: page_owner: add support for splitting to any order in split page_owner Zi Yan 2020-11-19 16:06 ` [PATCH 5/7] mm: thp: split huge page to any lower order pages Zi Yan 2020-11-19 16:06 ` [PATCH 6/7] mm: truncate: split thp to a non-zero order if possible Zi Yan 2020-11-19 16:06 ` [PATCH 7/7] mm: huge_memory: enable debugfs to split huge pages to any order Zi Yan
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --subject='Re: [PATCH 0/7] Split huge pages to any lower order pages and selftests.' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).