xarray-use-kmem_cache_alloc_lru-to-allocate-xa_node.patch removed from -mm tree
The patch titled
Subject: xarray: use kmem_cache_alloc_lru to allocate xa_node
has been removed from the -mm tree. Its filename was
xarray-use-kmem_cache_alloc_lru-to-allocate-xa_node.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Muchun Song <[email protected]>
Subject: xarray: use kmem_cache_alloc_lru to allocate xa_node
The workingset will add the xa_node to the shadow_nodes list. So the allocation of xa_node should be done by kmem_cache_alloc_lru(). Using 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.
---
include/linux/swap.h | 5 ++++- include/linux/xarray.h | 9 ++++++++- lib/xarray.c | 10 +++++----- mm/workingset.c | 2 +- 4 files changed, 18 insertions(+), 8 deletions(-)
include/linux/swap.h renamed from include/linux/swap.h~xarray-use-kmem_cache_alloc_lru-to-allocate-xa_node +4 -1
@@ -334,9 +334,12 @@ void workingset_activation(struct 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)) \ + 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 */
include/linux/xarray.h renamed from include/linux/xarray.h~xarray-use-kmem_cache_alloc_lru-to-allocate-xa_node +8 -1
@@ -1317,6 +1317,7 @@ struct xa_state {struct xa_node *xa_node;struct xa_node *xa_alloc;xa_update_node_t xa_update; +struct list_lru *xa_lru; };/*
@@ -1336,7 +1337,8 @@ struct xa_state { .xa_pad = 0, \ .xa_node = XAS_RESTART, \ .xa_alloc = NULL, \ - .xa_update = NULL \ + .xa_update = NULL, \ + .xa_lru = NULL, \ }/**
@@ -1631,6 +1633,11 @@ static inline void xas_set_update(struct xas->xa_update = update; } +static inline void xas_set_lru (struct xa_state *xas,struct list_lru *lru) +{ + xas->xa_lru = lru; +} +/** * xas_next_entry() - Advance iterator to next present entry. * @xas: XArray operation state.
lib/xarray.c renamed from lib/xarray.c~xarray-use-kmem_cache_alloc_lru-to-allocate-xa_node +5 -5
@@ -302,7 +302,7 @@ bool xas_nomem(struct xa_state *xas, gfp }if (xas->xa->xa_flags &XA_FLAGS_ACCOUNT ) gfp |= __GFP_ACCOUNT; - xas->xa_alloc =kmem_cache_alloc (radix_tree_node_cachep, gfp); + xas->xa_alloc =kmem_cache_alloc_lru (radix_tree_node_cachep, xas->xa_lru, gfp);if (!xas->xa_alloc)return false; xas->xa_alloc->parent =NULL ;
@@ -334,10 +334,10 @@ static bool __xas_nomem(struct xa_state gfp |= __GFP_ACCOUNT;if (gfpflags_allow_blocking (gfp)) {xas_unlock_type (xas, lock_type); - xas->xa_alloc =kmem_cache_alloc (radix_tree_node_cachep, gfp); + xas->xa_alloc =kmem_cache_alloc_lru (radix_tree_node_cachep, xas->xa_lru, gfp);xas_lock_type (xas, lock_type); }else { - xas->xa_alloc =kmem_cache_alloc (radix_tree_node_cachep, gfp); + xas->xa_alloc =kmem_cache_alloc_lru (radix_tree_node_cachep, xas->xa_lru, gfp); }if (!xas->xa_alloc)return false;
@@ -371,7 +371,7 @@ static void *xas_alloc(struct xa_state *if (xas->xa->xa_flags &XA_FLAGS_ACCOUNT ) gfp |= __GFP_ACCOUNT; - node =kmem_cache_alloc (radix_tree_node_cachep, gfp); + node =kmem_cache_alloc_lru (radix_tree_node_cachep, xas->xa_lru, gfp);if (!node) {xas_set_err (xas, -ENOMEM );return NULL ;
@@ -1014,7 +1014,7 @@ void xas_split_alloc(struct xa_state *xavoid *sibling =NULL ;struct xa_node *node; - node =kmem_cache_alloc (radix_tree_node_cachep, gfp); + node =kmem_cache_alloc_lru (radix_tree_node_cachep, xas->xa_lru, gfp);if (!node) goto nomem; node->array = xas->xa;
mm/workingset.c renamed from mm/workingset.c~xarray-use-kmem_cache_alloc_lru-to-allocate-xa_node +1 -1
@@ -429,7 +429,7 @@ out:* 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) {
_
Patches currently in -mm which might be from [email protected] are