]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mm: move mapping_set_update out of <linux/swap.h>
authorChristoph Hellwig <hch@lst.de>
Mon, 19 Feb 2024 06:27:09 +0000 (07:27 +0100)
committerChandan Babu R <chandanbabu@kernel.org>
Wed, 21 Feb 2024 06:06:50 +0000 (11:36 +0530)
mapping_set_update is only used inside mm/.  Move mapping_set_update to
mm/internal.h and turn it into an inline function instead of a macro.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
include/linux/swap.h
mm/filemap.c
mm/internal.h
mm/workingset.c

index 4db00ddad26169060e1d42d5ca9b9723546ab81c..755fc64ba48deda82e2ec7892db202dee995e980 100644 (file)
@@ -350,16 +350,6 @@ void *workingset_eviction(struct folio *folio, struct mem_cgroup *target_memcg);
 void workingset_refault(struct folio *folio, void *shadow);
 void workingset_activation(struct folio *folio);
 
-/* Only track the nodes of mappings with shadow entries */
-void workingset_update_node(struct xa_node *node);
-extern struct list_lru shadow_nodes;
-#define mapping_set_update(xas, mapping) do {                          \
-       if (!dax_mapping(mapping) && !shmem_mapping(mapping)) {         \
-               xas_set_update(xas, workingset_update_node);            \
-               xas_set_lru(xas, &shadow_nodes);                        \
-       }                                                               \
-} while (0)
-
 /* linux/mm/page_alloc.c */
 extern unsigned long totalreserve_pages;
 
index 750e779c23db74730fa7743c2307d1b996729d62..6c8b089f00d26af8def778db01e2a9cc1d2caa04 100644 (file)
  *    ->private_lock           (zap_pte_range->block_dirty_folio)
  */
 
+static void mapping_set_update(struct xa_state *xas,
+               struct address_space *mapping)
+{
+       if (dax_mapping(mapping) || shmem_mapping(mapping))
+               return;
+       xas_set_update(xas, workingset_update_node);
+       xas_set_lru(xas, &shadow_nodes);
+}
+
 static void page_cache_delete(struct address_space *mapping,
                                   struct folio *folio, void *shadow)
 {
index f309a010d50fb6de06e6d613b7f23357a99164ef..4398f572485f00596bbd5af271479ff683b547d9 100644 (file)
@@ -1266,4 +1266,8 @@ static inline void shrinker_debugfs_remove(struct dentry *debugfs_entry,
 }
 #endif /* CONFIG_SHRINKER_DEBUG */
 
+/* Only track the nodes of mappings with shadow entries */
+void workingset_update_node(struct xa_node *node);
+extern struct list_lru shadow_nodes;
+
 #endif /* __MM_INTERNAL_H */
index 2260129743282d39d91c2c493936ec1301337105..f2a0ecaf708d76ac2c7ef9191e90459cfb2b704f 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/dax.h>
 #include <linux/fs.h>
 #include <linux/mm.h>
+#include "internal.h"
 
 /*
  *             Double CLOCK lists