summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorYu Zhao <yuzhao@google.com>2022-11-15 18:38:08 -0700
committerAndrew Morton <akpm@linux-foundation.org>2022-11-30 15:59:00 -0800
commit931b6a8b36a2de3985eca27e758900e70cd99779 (patch)
treef75fc063cd2cb9331aac3047c0f5490b40ebe04b /mm
parentf347454d034184b4f0a2caf6e14daf7848cea01c (diff)
downloadlinux-stable-931b6a8b36a2de3985eca27e758900e70cd99779.tar.gz
linux-stable-931b6a8b36a2de3985eca27e758900e70cd99779.tar.bz2
linux-stable-931b6a8b36a2de3985eca27e758900e70cd99779.zip
mm: multi-gen LRU: remove NULL checks on NODE_DATA()
NODE_DATA() is preallocated for all possible nodes after commit 09f49dca570a ("mm: handle uninitialized numa nodes gracefully"). Checking its return value against NULL is now unnecessary. Link: https://lkml.kernel.org/r/20221116013808.3995280-2-yuzhao@google.com Signed-off-by: Yu Zhao <yuzhao@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmscan.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 82f32c929b11..805fa51b175c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -3166,7 +3166,7 @@ static struct lruvec *get_lruvec(struct mem_cgroup *memcg, int nid)
if (memcg) {
struct lruvec *lruvec = &memcg->nodeinfo[nid]->lruvec;
- /* for hotadd_new_pgdat() */
+ /* see the comment in mem_cgroup_lruvec() */
if (!lruvec->pgdat)
lruvec->pgdat = pgdat;
@@ -3175,7 +3175,7 @@ static struct lruvec *get_lruvec(struct mem_cgroup *memcg, int nid)
#endif
VM_WARN_ON_ONCE(!mem_cgroup_disabled());
- return pgdat ? &pgdat->__lruvec : NULL;
+ return &pgdat->__lruvec;
}
static int get_swappiness(struct lruvec *lruvec, struct scan_control *sc)
@@ -3239,9 +3239,6 @@ void lru_gen_add_mm(struct mm_struct *mm)
for_each_node_state(nid, N_MEMORY) {
struct lruvec *lruvec = get_lruvec(memcg, nid);
- if (!lruvec)
- continue;
-
/* the first addition since the last iteration */
if (lruvec->mm_state.tail == &mm_list->fifo)
lruvec->mm_state.tail = &mm->lru_gen.list;
@@ -3271,9 +3268,6 @@ void lru_gen_del_mm(struct mm_struct *mm)
for_each_node(nid) {
struct lruvec *lruvec = get_lruvec(memcg, nid);
- if (!lruvec)
- continue;
-
/* where the last iteration ended (exclusive) */
if (lruvec->mm_state.tail == &mm->lru_gen.list)
lruvec->mm_state.tail = lruvec->mm_state.tail->next;
@@ -5348,9 +5342,6 @@ static void lru_gen_change_state(bool enabled)
for_each_node(nid) {
struct lruvec *lruvec = get_lruvec(memcg, nid);
- if (!lruvec)
- continue;
-
spin_lock_irq(&lruvec->lru_lock);
VM_WARN_ON_ONCE(!seq_is_valid(lruvec));