mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mm/swapops: make is_pmd_migration_entry more strict
@ 2022-04-28  7:35 Hongchen Zhang
  2022-04-28 18:41 ` Peter Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Hongchen Zhang @ 2022-04-28  7:35 UTC (permalink / raw)
  To: Andrew Morton, Alistair Popple, Peter Xu, Ralph Campbell,
	Naoya Horiguchi, linux-kernel, Hongchen Zhang

a pmd migration entry should first be a swap pmd,so
use is_swap_pmd(pmd) instead of !pmd_present(pmd).

On the other hand, some architecture (MIPS for example)
may misjudge a pmd_none entry as a pmd migration entry.

Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
---
 include/linux/swapops.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/swapops.h b/include/linux/swapops.h
index d356ab4..1d16569 100644
--- a/include/linux/swapops.h
+++ b/include/linux/swapops.h
@@ -304,7 +304,7 @@ static inline pmd_t swp_entry_to_pmd(swp_entry_t entry)
 
 static inline int is_pmd_migration_entry(pmd_t pmd)
 {
-	return !pmd_present(pmd) && is_migration_entry(pmd_to_swp_entry(pmd));
+	return is_swap_pmd(pmd) && is_migration_entry(pmd_to_swp_entry(pmd));
 }
 #else
 static inline void set_pmd_migration_entry(struct page_vma_mapped_walk *pvmw,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-04-29 13:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28  7:35 [PATCH] mm/swapops: make is_pmd_migration_entry more strict Hongchen Zhang
2022-04-28 18:41 ` Peter Xu
2022-04-29  2:23   ` Hongchen Zhang
2022-04-29 13:31     ` Peter Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®