[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 7 Jul 2021 13:53:26 -0700
From: Shakeel Butt <shakeelb@...gle.com>
To: Hugh Dickins <hughd@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Alistair Popple <apopple@...dia.com>,
Jason Gunthorpe <jgg@...dia.com>,
Ralph Campbell <rcampbell@...dia.com>,
Christoph Hellwig <hch@....de>, Yang Shi <shy828301@...il.com>,
"Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
LKML <linux-kernel@...r.kernel.org>,
Linux MM <linux-mm@...ck.org>
Subject: Re: [PATCH 2/4] mm/rmap: fix old bug: munlocking THP missed other mlocks
On Wed, Jul 7, 2021 at 1:08 PM Hugh Dickins <hughd@...gle.com> wrote:
>
> The kernel recovers in due course from missing Mlocked pages: but there
> was no point in calling page_mlock() (formerly known as try_to_munlock())
> on a THP, because nothing got done even when it was found to be mapped in
> another VM_LOCKED vma.
>
> It's true that we need to be careful: Mlocked accounting of pte-mapped
> THPs is too difficult (so consistently avoided); but Mlocked accounting
> of only-pmd-mapped THPs is supposed to work, even when multiple mappings
> are mlocked and munlocked or munmapped. Refine the tests.
>
> There is already a VM_BUG_ON_PAGE(PageDoubleMap) in page_mlock(), so
> page_mlock_one() does not even have to worry about that complication.
>
> (I said the kernel recovers: but would page reclaim be likely to split
> THP before rediscovering that it's VM_LOCKED? I've not followed that up.)
I think, yes, page reclaim will split the THP prematurely in this case.
>
> Fixes: 9a73f61bdb8a ("thp, mlock: do not mlock PTE-mapped file huge pages")
> Signed-off-by: Hugh Dickins <hughd@...gle.com>
Reviewed-by: Shakeel Butt <shakeelb@...gle.com>
Powered by blists - more mailing lists