[RFC v1 04/19] mm, slub: use for_each_node in get_any_partial()

Pengfei Li
2019-11-21T15:20:17Z

In get_any_partial(), we want to traverse node instead of zone, so
use for_each_node instead of for_each_zone.

Signed-off-by: Pengfei Li <fly@kernel.page>
---
mm/slub.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index ad1abfbc57b1..2fe3edbcf296 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1905,10 +1905,10 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags,
struct kmem_cache_cpu *c)
{
#ifdef CONFIG_NUMA
+ enum zone_type high_zoneidx = gfp_zone(flags);
struct nodelist *nodelist;
struct nlist_traverser t;
- struct zone *zone;
- enum zone_type high_zoneidx = gfp_zone(flags);
+ int node;
void *object;
unsigned int cpuset_mems_cookie;

@@ -1937,12 +1937,12 @@ static void *get_any_partial(struct kmem_cache *s, gfp_t flags,
do {
cpuset_mems_cookie = read_mems_allowed_begin();
nodelist = node_nodelist(mempolicy_slab_node(), flags);
- for_each_zone_nlist(zone, &t, nodelist, high_zoneidx) {
+ for_each_node_nlist(node, &t, nodelist, high_zoneidx) {
struct kmem_cache_node *n;

- n = get_node(s, zone_to_nid(zone));
+ n = get_node(s, node);

- if (n && cpuset_zone_allowed(zone, flags) &&
+ if (n && cpuset_node_allowed(node, flags) &&
n->nr_partial > s->min_partial) {
object = get_partial_node(s, n, c, flags);
if (object) {
--
2.23.0