[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f22c9fc8-2356-46c6-ac8e-dc97328d7fcc@linux.alibaba.com>
Date: Tue, 14 May 2024 14:41:27 +0800
From: Baolin Wang <baolin.wang@...ux.alibaba.com>
To: Lance Yang <ioworker0@...il.com>, akpm@...ux-foundation.org
Cc: willy@...radead.org, sj@...nel.org, maskray@...gle.com, ziy@...dia.com,
ryan.roberts@....com, david@...hat.com, 21cnbao@...il.com, mhocko@...e.com,
fengwei.yin@...el.com, zokeefe@...gle.com, shy828301@...il.com,
xiehuan09@...il.com, libang.li@...group.com, wangkefeng.wang@...wei.com,
songmuchun@...edance.com, peterx@...hat.com, minchan@...nel.org,
linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH RESEND v5 3/4] mm/mlock: check for THP missing the mlock
in try_to_unmap_one()
On 2024/5/13 15:47, Lance Yang wrote:
> The TTU_SPLIT_HUGE_PMD will no longer perform immediately, so we might
> encounter a PMD-mapped THP missing the mlock in the VM_LOCKED range
> during the pagewalk. It's likely necessary to mlock this THP to prevent
> it from being picked up during page reclaim.
>
> Suggested-by: Baolin Wang <baolin.wang@...ux.alibaba.com>
> Signed-off-by: Lance Yang <ioworker0@...il.com>
IMO, this patch should be merged into patch 2, otherwise patch 2 is
buggy. Quote the description in the 'submission patches.rst' document:
"When dividing your change into a series of patches, take special care
to ensure that the kernel builds and runs properly after each patch in
the series. Developers using ``git bisect`` to track down a problem can
end up splitting your patch series at any point; they will not thank you
if you introduce bugs in the middle."
> ---
> mm/rmap.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/rmap.c b/mm/rmap.c
> index 4c4d14325f2e..08a93347f283 100644
> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1671,7 +1671,8 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
> if (!(flags & TTU_IGNORE_MLOCK) &&
> (vma->vm_flags & VM_LOCKED)) {
> /* Restore the mlock which got missed */
> - if (!folio_test_large(folio))
> + if (!folio_test_large(folio) ||
> + (!pvmw.pte && (flags & TTU_SPLIT_HUGE_PMD)))
> mlock_vma_folio(folio, vma);
> goto walk_done_err;
> }
Powered by blists - more mailing lists