[PATCH v2 13/21] mm: workingset: use xas_set_lru() to pass shadow_nodes
From: Muchun Song
Date: Thu May 27 2021 - 02:26:25 EST
The workingset will add the xa_node to shadow_nodes, so we should use
xas_set_lru() to pass the list_lru which we want to insert xa_node
into to set up the xa_node reclaim context correctly.
Signed-off-by: Muchun Song <songmuchun@xxxxxxxxxxxxx>
---
include/linux/swap.h | 5 ++++-
mm/workingset.c | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/include/linux/swap.h b/include/linux/swap.h
index 46d51d058d05..a2e1363b1509 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -323,9 +323,12 @@ void workingset_activation(struct page *page);
/* 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)) \
+ 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 */
diff --git a/mm/workingset.c b/mm/workingset.c
index 4f7a306ce75a..e50827fc3994 100644
--- a/mm/workingset.c
+++ b/mm/workingset.c
@@ -426,7 +426,7 @@ void workingset_activation(struct page *page)
* point where they would still be useful.
*/
-static struct list_lru shadow_nodes;
+struct list_lru shadow_nodes;
void workingset_update_node(struct xa_node *node)
{
--
2.11.0