On Mon, Mar 15, 2021 at 11:37 AM Zi Yan <ziy@xxxxxxxxxx> wrote: > > On 15 Mar 2021, at 8:07, Kirill A. Shutemov wrote: > > > On Thu, Mar 11, 2021 at 07:57:12PM -0500, Zi Yan wrote: > >> From: Zi Yan <ziy@xxxxxxxxxx> > >> > >> We do not have a direct user interface of splitting the compound page > >> backing a THP > > > > But we do. You expand it. > > > >> and there is no need unless we want to expose the THP > >> implementation details to users. Make <debugfs>/split_huge_pages accept > >> a new command to do that. > >> > >> By writing "<pid>,<vaddr_start>,<vaddr_end>" to > >> <debugfs>/split_huge_pages, THPs within the given virtual address range > >> from the process with the given pid are split. It is used to test > >> split_huge_page function. In addition, a selftest program is added to > >> tools/testing/selftests/vm to utilize the interface by splitting > >> PMD THPs and PTE-mapped THPs. > >> > > > > Okay, makes sense. > > > > But it doesn't cover non-mapped THPs. tmpfs may have file backed by THP > > that mapped nowhere. Do we want to cover this case too? > > Sure. It would be useful when large page in page cache too. I will send > v4 with tmpfs THP split. I will definitely need a review for it, since > I am not familiar with getting a page from a file path. We do have some APIs to return pages for a file range, i.e. find_get_page find_get_pages find_get_entries find_get_pages_range They all need address_space, so you need to convert file path to address_space before using them. The hole punch of tmpfs uses find_get_entries(), just check what shmem_undo_range() does. > > > Maybe have PID:<pid>,<vaddr_start>,<vaddr_end> and > > FILE:<path>,<off_start>,<off_end> ? > > Or just check input[0] == ‘/‘ for file path input. > > > — > Best Regards, > Yan Zi