]> git.baikalelectronics.ru Git - kernel.git/commit
mm/rmap: fix munlocking Anon THP with mlocked ptes
authorHugh Dickins <hughd@google.com>
Mon, 12 Jul 2021 03:10:49 +0000 (20:10 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 12 Jul 2021 18:30:56 +0000 (11:30 -0700)
commit3b08f2b34e419f4015c5081634e260ce9acfb77f
tree8839da504223a882c72890dde4d56c9c44d5e6a4
parent01da9c8979f3d24bb75ef7080a8d9915e88dff94
mm/rmap: fix munlocking Anon THP with mlocked ptes

Many thanks to Kirill for reminding that PageDoubleMap cannot be relied on
to warn of pte mappings in the Anon THP case; and a scan of subpages does
not seem appropriate here.  Note how follow_trans_huge_pmd() does not even
mark an Anon THP as mlocked when compound_mapcount != 1: multiple mlocking
of Anon THP is avoided, so simply return from page_mlock() in this case.

Link: https://lore.kernel.org/lkml/cfa154c-d595-406-eb7d-eb9df730f944@google.com/
Fixes: d8d57d4013af ("mm/rmap: fix old bug: munlocking THP missed other mlocks")
Reported-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Yang Shi <shy828301@gmail.com>
Cc: Shakeel Butt <shakeelb@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/rmap.c