Skip to content

Commit 8cefd27

Browse files
author
Rafael Aquini
committed
mm: move mapping_set_update out of <linux/swap.h>
JIRA: https://issues.redhat.com/browse/RHEL-84184 This patch is a backport of the following upstream commit: commit b64e74e Author: Christoph Hellwig <hch@lst.de> Date: Mon Feb 19 07:27:09 2024 +0100 mm: move mapping_set_update out of <linux/swap.h> 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> Signed-off-by: Rafael Aquini <raquini@redhat.com>
1 parent e3c54fd commit 8cefd27

File tree

4 files changed

+14
-10
lines changed

4 files changed

+14
-10
lines changed

include/linux/swap.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -353,16 +353,6 @@ void *workingset_eviction(struct folio *folio, struct mem_cgroup *target_memcg);
353353
void workingset_refault(struct folio *folio, void *shadow);
354354
void workingset_activation(struct folio *folio);
355355

356-
/* Only track the nodes of mappings with shadow entries */
357-
void workingset_update_node(struct xa_node *node);
358-
extern struct list_lru shadow_nodes;
359-
#define mapping_set_update(xas, mapping) do { \
360-
if (!dax_mapping(mapping) && !shmem_mapping(mapping)) { \
361-
xas_set_update(xas, workingset_update_node); \
362-
xas_set_lru(xas, &shadow_nodes); \
363-
} \
364-
} while (0)
365-
366356
/* linux/mm/page_alloc.c */
367357
extern unsigned long totalreserve_pages;
368358

mm/filemap.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@
123123
* ->private_lock (zap_pte_range->block_dirty_folio)
124124
*/
125125

126+
static void mapping_set_update(struct xa_state *xas,
127+
struct address_space *mapping)
128+
{
129+
if (dax_mapping(mapping) || shmem_mapping(mapping))
130+
return;
131+
xas_set_update(xas, workingset_update_node);
132+
xas_set_lru(xas, &shadow_nodes);
133+
}
134+
126135
static void page_cache_delete(struct address_space *mapping,
127136
struct folio *folio, void *shadow)
128137
{

mm/internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,4 +1270,8 @@ static inline void shrinker_debugfs_remove(struct dentry *debugfs_entry,
12701270
}
12711271
#endif /* CONFIG_SHRINKER_DEBUG */
12721272

1273+
/* Only track the nodes of mappings with shadow entries */
1274+
void workingset_update_node(struct xa_node *node);
1275+
extern struct list_lru shadow_nodes;
1276+
12731277
#endif /* __MM_INTERNAL_H */

mm/workingset.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/dax.h>
1717
#include <linux/fs.h>
1818
#include <linux/mm.h>
19+
#include "internal.h"
1920

2021
/*
2122
* Double CLOCK lists

0 commit comments

Comments
 (0)