On Thu, 6 Apr 2023 at 23:12, Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx> wrote: > On 4/7/23 1:12 AM, Michał Mirosław wrote: > > On Thu, 6 Apr 2023 at 09:40, Muhammad Usama Anjum > > <usama.anjum@xxxxxxxxxxxxx> wrote: > > [...] > >> --- a/fs/proc/task_mmu.c > >> +++ b/fs/proc/task_mmu.c > > [...] > >> +static int pagemap_scan_pmd_entry(pmd_t *pmd, unsigned long start, > >> + unsigned long end, struct mm_walk *walk) > >> +{ [...] > >> +#ifdef CONFIG_TRANSPARENT_HUGEPAGE > >> + ptl = pmd_trans_huge_lock(pmd, vma); > >> + if (ptl) { > > [...] > >> + return ret; > >> + } > >> +process_smaller_pages: > >> + if (pmd_trans_unstable(pmd)) > >> + return 0; > > > > Why pmd_trans_unstable() is needed here and not only after split_huge_pmd()? > I'm not entirely sure. But the idea is if THP is unstable, we should > return. As it doesn't seem like after splitting THP can be unstable, we > should not check it. Do you agree with the following? The description of pmd_trans_unstable() [1] seems to indicate that it is needed only after split_huge_pmd(). [1] https://elixir.bootlin.com/linux/v6.3-rc5/source/include/linux/pgtable.h#L1394 Best Regards Michał Mirosław