Re: [PATCH v8 mm-new 01/12] mm: thp: remove disabled task from khugepaged_mm_slot

From: Yafang Shao

Date: Sat Sep 27 2025 - 22:22:14 EST


On Fri, Sep 26, 2025 at 10:11 PM Usama Arif <usamaarif642@xxxxxxxxx> wrote:
>
>
>
> On 26/09/2025 10:33, Yafang Shao wrote:
> > Since a task with MMF_DISABLE_THP_COMPLETELY cannot use THP, remove it from
> > the khugepaged_mm_slot to stop khugepaged from processing it.
> >
> > After this change, the following semantic relationship always holds:
> >
> > MMF_VM_HUGEPAGE is set == task is in khugepaged mm_slot
> > MMF_VM_HUGEPAGE is not set == task is not in khugepaged mm_slot
> >
> > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx>
> > Acked-by: Lance Yang <lance.yang@xxxxxxxxx>
> > ---
> > include/linux/khugepaged.h | 4 ++++
> > kernel/sys.c | 7 ++++--
> > mm/khugepaged.c | 49 ++++++++++++++++++++------------------
> > 3 files changed, 35 insertions(+), 25 deletions(-)
> >
>
>
> Hi Yafang,
>
> Thanks for the patch! Sorry wasnt able to review the previous revisions.
>
> I think it would be good to separate this patch out of the series?

right. This commit is independent of this series. I will send it seperately.

> It would make the review of this series shorter and this patch can be merged independently.
>
> In the commit message, we also need to write explicitly that when prctl
> PR_SET_THP_DISABLE is cleared, the mm is added back for khugepaged to consider.

ack.

>
> Could you also mention in the commit message why the BUG was turned into WARN?
>

I believe we should replace VM_BUG_ON_MM() with VM_WARN_ON_MM() [0]. A
warning is sufficient for debugging in this context.

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/deprecated.rst#n32

--
Regards
Yafang