Commit 6e018968 authored by Sebastian Andrzej Siewior's avatar Sebastian Andrzej Siewior Committed by Linus Torvalds

mm/list_lru.c: pass struct list_lru_node* as an argument to __list_lru_walk_one()

__list_lru_walk_one() is invoked with struct list_lru *lru, int nid as
the first two argument.  Those two are only used to retrieve struct
list_lru_node.  Since this is already done by the caller of the function
for the locking, we can pass struct list_lru_node* directly and avoid
the dance around it.

Link: http://lkml.kernel.org/r/20180716111921.5365-4-bigeasy@linutronix.deSigned-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
Reviewed-by: default avatarVladimir Davydov <vdavydov.dev@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6cfe57a9
...@@ -209,12 +209,11 @@ unsigned long list_lru_count_node(struct list_lru *lru, int nid) ...@@ -209,12 +209,11 @@ unsigned long list_lru_count_node(struct list_lru *lru, int nid)
EXPORT_SYMBOL_GPL(list_lru_count_node); EXPORT_SYMBOL_GPL(list_lru_count_node);
static unsigned long static unsigned long
__list_lru_walk_one(struct list_lru *lru, int nid, int memcg_idx, __list_lru_walk_one(struct list_lru_node *nlru, int memcg_idx,
list_lru_walk_cb isolate, void *cb_arg, list_lru_walk_cb isolate, void *cb_arg,
unsigned long *nr_to_walk) unsigned long *nr_to_walk)
{ {
struct list_lru_node *nlru = &lru->node[nid];
struct list_lru_one *l; struct list_lru_one *l;
struct list_head *item, *n; struct list_head *item, *n;
unsigned long isolated = 0; unsigned long isolated = 0;
...@@ -276,8 +275,8 @@ list_lru_walk_one(struct list_lru *lru, int nid, struct mem_cgroup *memcg, ...@@ -276,8 +275,8 @@ list_lru_walk_one(struct list_lru *lru, int nid, struct mem_cgroup *memcg,
unsigned long ret; unsigned long ret;
spin_lock(&nlru->lock); spin_lock(&nlru->lock);
ret = __list_lru_walk_one(lru, nid, memcg_cache_id(memcg), ret = __list_lru_walk_one(nlru, memcg_cache_id(memcg), isolate, cb_arg,
isolate, cb_arg, nr_to_walk); nr_to_walk);
spin_unlock(&nlru->lock); spin_unlock(&nlru->lock);
return ret; return ret;
} }
...@@ -297,8 +296,9 @@ unsigned long list_lru_walk_node(struct list_lru *lru, int nid, ...@@ -297,8 +296,9 @@ unsigned long list_lru_walk_node(struct list_lru *lru, int nid,
struct list_lru_node *nlru = &lru->node[nid]; struct list_lru_node *nlru = &lru->node[nid];
spin_lock(&nlru->lock); spin_lock(&nlru->lock);
isolated += __list_lru_walk_one(lru, nid, memcg_idx, isolated += __list_lru_walk_one(nlru, memcg_idx,
isolate, cb_arg, nr_to_walk); isolate, cb_arg,
nr_to_walk);
spin_unlock(&nlru->lock); spin_unlock(&nlru->lock);
if (*nr_to_walk <= 0) if (*nr_to_walk <= 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment