Re: [PATCH 3/7] mm,madvise: call soft_offline_page() without MF_COUNT_INCREASED

From: Oscar Salvador
Date: Mon Dec 07 2020 - 02:25:58 EST


On 2020-12-07 03:34, HORIGUCHI NAOYA wrote:
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 869ece2a1de2..ba861169c9ae 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1269,6 +1269,12 @@ static int memory_failure_dev_pagemap(unsigned long pfn, int flags,
if (!cookie)
goto out;

+ if (flags & MF_COUNT_INCREASED)
+ /*
+ * Drop the extra refcount in case we come from madvise().
+ */
+ put_page(page);
+

Should this if-block come before dax_lock_page() block?

Yeah, it should go first thing since as you noticed we kept the refcount if we fail.
Saturday brain... I will fix it.

Thanks Naoya

--
Oscar Salvador
SUSE L3