]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
mm: memcontrol: remove the pgdata parameter of mem_cgroup_page_lruvec
authorMuchun Song <songmuchun@bytedance.com>
Tue, 29 Jun 2021 02:37:53 +0000 (19:37 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 29 Jun 2021 17:53:50 +0000 (10:53 -0700)
All the callers of mem_cgroup_page_lruvec() just pass page_pgdat(page) as
the 2nd parameter to it (except isolate_migratepages_block()).  But for
isolate_migratepages_block(), the page_pgdat(page) is also equal to the
local variable of @pgdat.  So mem_cgroup_page_lruvec() do not need the
pgdat parameter.  Just remove it to simplify the code.

Link: https://lkml.kernel.org/r/20210417043538.9793-4-songmuchun@bytedance.com
Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Roman Gushchin <guro@fb.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: Xiongchun Duan <duanxiongchun@bytedance.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/memcontrol.h
mm/compaction.c
mm/memcontrol.c
mm/swap.c
mm/workingset.c

index c193be7607090590dc4b5d8c9df5421909ce237f..f2a5aaba3577549489603441465ba501cc384192 100644 (file)
@@ -743,13 +743,12 @@ out:
 /**
  * mem_cgroup_page_lruvec - return lruvec for isolating/putting an LRU page
  * @page: the page
- * @pgdat: pgdat of the page
  *
  * This function relies on page->mem_cgroup being stable.
  */
-static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page,
-                                               struct pglist_data *pgdat)
+static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page)
 {
+       pg_data_t *pgdat = page_pgdat(page);
        struct mem_cgroup *memcg = page_memcg(page);
 
        VM_WARN_ON_ONCE_PAGE(!memcg && !mem_cgroup_disabled(), page);
@@ -1221,9 +1220,10 @@ static inline struct lruvec *mem_cgroup_lruvec(struct mem_cgroup *memcg,
        return &pgdat->__lruvec;
 }
 
-static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page,
-                                                   struct pglist_data *pgdat)
+static inline struct lruvec *mem_cgroup_page_lruvec(struct page *page)
 {
+       pg_data_t *pgdat = page_pgdat(page);
+
        return &pgdat->__lruvec;
 }
 
index 84fde270ae74f2117caf70f3b9cc5516acdd8644..7d41b58fb17c872f703480484a50bd9c15d0cb93 100644 (file)
@@ -1028,7 +1028,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
                if (!TestClearPageLRU(page))
                        goto isolate_fail_put;
 
-               lruvec = mem_cgroup_page_lruvec(page, pgdat);
+               lruvec = mem_cgroup_page_lruvec(page);
 
                /* If we already hold the lock, we can skip some rechecking */
                if (lruvec != locked) {
index babbaf49ee368eb32c1431cfbd717b383c539c84..946a9a483e719db75a5e7f7fcf1ae1264f535928 100644 (file)
@@ -1199,9 +1199,8 @@ void lruvec_memcg_debug(struct lruvec *lruvec, struct page *page)
 struct lruvec *lock_page_lruvec(struct page *page)
 {
        struct lruvec *lruvec;
-       struct pglist_data *pgdat = page_pgdat(page);
 
-       lruvec = mem_cgroup_page_lruvec(page, pgdat);
+       lruvec = mem_cgroup_page_lruvec(page);
        spin_lock(&lruvec->lru_lock);
 
        lruvec_memcg_debug(lruvec, page);
@@ -1212,9 +1211,8 @@ struct lruvec *lock_page_lruvec(struct page *page)
 struct lruvec *lock_page_lruvec_irq(struct page *page)
 {
        struct lruvec *lruvec;
-       struct pglist_data *pgdat = page_pgdat(page);
 
-       lruvec = mem_cgroup_page_lruvec(page, pgdat);
+       lruvec = mem_cgroup_page_lruvec(page);
        spin_lock_irq(&lruvec->lru_lock);
 
        lruvec_memcg_debug(lruvec, page);
@@ -1225,9 +1223,8 @@ struct lruvec *lock_page_lruvec_irq(struct page *page)
 struct lruvec *lock_page_lruvec_irqsave(struct page *page, unsigned long *flags)
 {
        struct lruvec *lruvec;
-       struct pglist_data *pgdat = page_pgdat(page);
 
-       lruvec = mem_cgroup_page_lruvec(page, pgdat);
+       lruvec = mem_cgroup_page_lruvec(page);
        spin_lock_irqsave(&lruvec->lru_lock, *flags);
 
        lruvec_memcg_debug(lruvec, page);
index dfb48cf9c2c9bb86df694f251c36bd091548b729..18cc9e63515b84c0b31b02c6fbcbdddd2c7259c1 100644 (file)
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -313,7 +313,7 @@ void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages)
 
 void lru_note_cost_page(struct page *page)
 {
-       lru_note_cost(mem_cgroup_page_lruvec(page, page_pgdat(page)),
+       lru_note_cost(mem_cgroup_page_lruvec(page),
                      page_is_file_lru(page), thp_nr_pages(page));
 }
 
index b7cdeca5a76de94d8dbb63b9acbcc551c043b393..4f7a306ce75a5270f4f1720edc02ed29984fa67a 100644 (file)
@@ -408,7 +408,7 @@ void workingset_activation(struct page *page)
        memcg = page_memcg_rcu(page);
        if (!mem_cgroup_disabled() && !memcg)
                goto out;
-       lruvec = mem_cgroup_page_lruvec(page, page_pgdat(page));
+       lruvec = mem_cgroup_page_lruvec(page);
        workingset_age_nonresident(lruvec, thp_nr_pages(page));
 out:
        rcu_read_unlock();