On Thu, Mar 11, 2021 at 7:52 AM Zi Yan ziy@nvidia.com wrote:
On 10 Mar 2021, at 20:12, Yang Shi wrote:
On Wed, Mar 10, 2021 at 7:36 AM Zi Yan zi.yan@sent.com wrote:
From: Zi Yan ziy@nvidia.com
We do not have a direct user interface of splitting the compound page backing a THP and there is no need unless we want to expose the THP implementation details to users. Adding an interface for debugging.
By writing "<pid>,<vaddr_start>,<vaddr_end>" to <debugfs>/split_huge_pages_in_range_pid, THPs within the given virtual
Can we reuse the existing split_huge_page knob instead of creating a new one?
Two knobs for splitting huge pages on debugging purpose seem overkilling to me IMHO. I'm wondering if we could check if a special value (e.g. 1 or -1) is written then split all THPs as split_huge_page knob does?
I don't think this interface is used widely so the risk should be very low for breaking userspace.
Thanks for the suggestion.
I prefer a separate interface to keep input handling simpler. I am also planning to enhance this interface later to enable splitting huge pages to any lower order when Matthew Wilcox’s large page in page cache gets in, so it is better to keep it separate from existing split_huge_pages.
The input handling seems not that hard, you might be able to try to do:
ret = sscanf(input_buf, "%d,0x%lx,0x%lx,%d", &pid, &vaddr_start, &vaddr_end, order); switch(ret) { case ret == 1: split_all_thps case ret == 3: split_thp_for_pid case ret == 4: split_thp_for_pid_to_order default: return -EINVAL }
Will it work for you?
— Best Regards, Yan Zi