Commit b8b0ff24 authored by Alex Shi (tencent)'s avatar Alex Shi (tencent) Committed by Andrew Morton

mm/ksm: add folio_set_stable_node

Turn set_page_stable_node() into a wrapper folio_set_stable_node, and then
use it to replace the former.  we will merge them together after all place
converted to folio.

Link: https://lkml.kernel.org/r/20240411061713.1847574-4-alexs@kernel.orgSigned-off-by: default avatarAlex Shi (tencent) <alexs@kernel.org>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Cc: Izik Eidus <izik.eidus@ravellosystems.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent f39b6e2d
...@@ -1109,6 +1109,12 @@ static inline void set_page_stable_node(struct page *page, ...@@ -1109,6 +1109,12 @@ static inline void set_page_stable_node(struct page *page,
page->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM); page->mapping = (void *)((unsigned long)stable_node | PAGE_MAPPING_KSM);
} }
static inline void folio_set_stable_node(struct folio *folio,
struct ksm_stable_node *stable_node)
{
set_page_stable_node(&folio->page, stable_node);
}
#ifdef CONFIG_SYSFS #ifdef CONFIG_SYSFS
/* /*
* Only called through the sysfs control interface: * Only called through the sysfs control interface:
...@@ -3241,7 +3247,7 @@ void folio_migrate_ksm(struct folio *newfolio, struct folio *folio) ...@@ -3241,7 +3247,7 @@ void folio_migrate_ksm(struct folio *newfolio, struct folio *folio)
* has gone stale (or that folio_test_swapcache has been cleared). * has gone stale (or that folio_test_swapcache has been cleared).
*/ */
smp_wmb(); smp_wmb();
set_page_stable_node(&folio->page, NULL); folio_set_stable_node(folio, NULL);
} }
} }
#endif /* CONFIG_MIGRATION */ #endif /* CONFIG_MIGRATION */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment