[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAa6QmQw+F=o6htOn=6ADD6mwvMO=Ow_67f3ifBv3GpXx9Xg_g@mail.gmail.com>
Date: Sat, 12 Aug 2023 14:24:40 -0700
From: "Zach O'Keefe" <zokeefe@...gle.com>
To: linux-mm@...ck.org, Yang Shi <shy828301@...il.com>
Cc: linux-kernel@...r.kernel.org,
Saurabh Singh Sengar <ssengar@...rosoft.com>
Subject: Re: [PATCH] mm/thp: fix "mm: thp: kill __transhuge_page_enabled()"
On Sat, Aug 12, 2023 at 2:01 PM Zach O'Keefe <zokeefe@...gle.com> wrote:
>
> The 6.0 commits:
>
> commit 9fec51689ff6 ("mm: thp: kill transparent_hugepage_active()")
> commit 7da4e2cb8b1f ("mm: thp: kill __transhuge_page_enabled()")
>
> merged "can we have THPs in this VMA?" logic that was previously done
> separately by fault-path, khugepaged, and smaps "THPeligible".
>
> During the process, the check on VM_NO_KHUGEPAGED from the khugepaged
> path was accidentally added to fault and smaps paths. Certainly the
> previous behavior for fault should be restored, and since smaps should
> report the union of THP eligibility for fault and khugepaged, also opt
> smaps out of this constraint.
>
> Fixes: 7da4e2cb8b1f ("mm: thp: kill __transhuge_page_enabled()")
> Reported-by: Saurabh Singh Sengar <ssengar@...rosoft.com>
> Signed-off-by: Zach O'Keefe <zokeefe@...gle.com>
> Cc: Yang Shi <shy828301@...il.com>
> ---
> mm/huge_memory.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index eb3678360b97..e098c26d5e2e 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -96,11 +96,11 @@ bool hugepage_vma_check(struct vm_area_struct *vma, unsigned long vm_flags,
> return in_pf;
>
> /*
> - * Special VMA and hugetlb VMA.
> + * khugepaged check for special VMA and hugetlb VMA.
> * Must be checked after dax since some dax mappings may have
> * VM_MIXEDMAP set.
> */
> - if (vm_flags & VM_NO_KHUGEPAGED)
> + if (!in_pf && !smaps && (vm_flags & VM_NO_KHUGEPAGED))
> return false;
>
> /*
> --
> 2.41.0.694.ge786442a9b-goog
>
I should note that this was discussed before[1], and VM_MIXEDMAP was
called out then, but we didn't have any use cases.
What was reported broken by Saurabh was an out-of-tree driver that
relies on being able to fault in THPs over VM_HUGEPAGE|VM_MIXEDMAP
VMAs. We mentioned back then we could always opt fault-path out of
this check in the future, and it seems like we should.
To that extent, should this be added to stable?
Apologies, I should have added this context to the commit log.
Best,
Zach
[1] https://lore.kernel.org/linux-mm/YqdPmitColnzlXJ0@google.com/
Powered by blists - more mailing lists