diff mbox series

[v2,10/10] mm: hwpoison_user_mappings() try_to_unmap() with TTU_SYNC

Message ID 329c28ed-95df-9a2c-8893-b444d8a6d340@google.com (mailing list archive)
State New, archived
Headers show
Series mm/thp: fix THP splitting unmap BUGs and related (fwd) | expand

Commit Message

Hugh Dickins June 9, 2021, 4:30 a.m. UTC
TTU_SYNC prevents an unlikely race, when try_to_unmap() returns shortly
before the page is accounted as unmapped.  It is unlikely to coincide
with hwpoisoning, but now that we have the flag, hwpoison_user_mappings()
would do well to use it.

Signed-off-by: Hugh Dickins <hughd@google.com>
---
Patch added since the v1 series was posted.

 mm/memory-failure.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kirill A . Shutemov June 9, 2021, 10:27 a.m. UTC | #1
On Tue, Jun 08, 2021 at 09:30:00PM -0700, Hugh Dickins wrote:
> TTU_SYNC prevents an unlikely race, when try_to_unmap() returns shortly
> before the page is accounted as unmapped.  It is unlikely to coincide
> with hwpoisoning, but now that we have the flag, hwpoison_user_mappings()
> would do well to use it.
> 
> Signed-off-by: Hugh Dickins <hughd@google.com>

Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
HORIGUCHI NAOYA(堀口 直也) June 10, 2021, 7:38 a.m. UTC | #2
On Tue, Jun 08, 2021 at 09:30:00PM -0700, Hugh Dickins wrote:
> TTU_SYNC prevents an unlikely race, when try_to_unmap() returns shortly
> before the page is accounted as unmapped.  It is unlikely to coincide
> with hwpoisoning, but now that we have the flag, hwpoison_user_mappings()
> would do well to use it.
>
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> Patch added since the v1 series was posted.
>
>  mm/memory-failure.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memory-failure.c b/mm/memory-failure.c
> index b6806e446567..e16edefca523 100644
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1060,7 +1060,7 @@ static int get_hwpoison_page(struct page *p, unsigned long flags,
>  static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
>  				  int flags, struct page **hpagep)
>  {
> -	enum ttu_flags ttu = TTU_IGNORE_MLOCK;
> +	enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC;

Thanks for improving thp code.

Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
diff mbox series

Patch

diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index b6806e446567..e16edefca523 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1060,7 +1060,7 @@  static int get_hwpoison_page(struct page *p, unsigned long flags,
 static bool hwpoison_user_mappings(struct page *p, unsigned long pfn,
 				  int flags, struct page **hpagep)
 {
-	enum ttu_flags ttu = TTU_IGNORE_MLOCK;
+	enum ttu_flags ttu = TTU_IGNORE_MLOCK | TTU_SYNC;
 	struct address_space *mapping;
 	LIST_HEAD(tokill);
 	bool unmap_success;