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
 /*
  * Only called through the sysfs control interface:
                 * has gone stale (or that folio_test_swapcache has been cleared).
                 */
                smp_wmb();
-               set_page_stable_node(&folio->page, NULL);
+               folio_set_stable_node(folio, NULL);
        }
 }
 #endif /* CONFIG_MIGRATION */