From: Michal Hocko <mhocko@suse.com>
To: Muchun Song <songmuchun@bytedance.com>
Cc: guro@fb.com, hannes@cmpxchg.org, akpm@linux-foundation.org,
shakeelb@google.com, vdavydov.dev@gmail.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
duanxiongchun@bytedance.com
Subject: Re: [PATCH v2 5/8] mm: memcontrol: rename lruvec_holds_page_lru_lock to page_matches_lruvec
Date: Fri, 16 Apr 2021 08:01:08 +0200 [thread overview]
Message-ID: <YHkoJI12iADTAP69@dhcp22.suse.cz> (raw)
In-Reply-To: <20210416051407.54878-6-songmuchun@bytedance.com>
On Fri 16-04-21 13:14:04, Muchun Song wrote:
> lruvec_holds_page_lru_lock() doesn't check anything about locking and is
> used to check whether the page belongs to the lruvec. So rename it to
> page_matches_lruvec().
>
> Signed-off-by: Muchun Song <songmuchun@bytedance.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Thanks
> ---
> include/linux/memcontrol.h | 7 +++----
> mm/vmscan.c | 2 +-
> 2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
> index 2fc728492c9b..40b0c31ea4ba 100644
> --- a/include/linux/memcontrol.h
> +++ b/include/linux/memcontrol.h
> @@ -1492,8 +1492,7 @@ static inline void unlock_page_lruvec_irqrestore(struct lruvec *lruvec,
> spin_unlock_irqrestore(&lruvec->lru_lock, flags);
> }
>
> -static inline bool lruvec_holds_page_lru_lock(struct page *page,
> - struct lruvec *lruvec)
> +static inline bool page_matches_lruvec(struct page *page, struct lruvec *lruvec)
> {
> return lruvec_pgdat(lruvec) == page_pgdat(page) &&
> lruvec_memcg(lruvec) == page_memcg(page);
> @@ -1504,7 +1503,7 @@ static inline struct lruvec *relock_page_lruvec_irq(struct page *page,
> struct lruvec *locked_lruvec)
> {
> if (locked_lruvec) {
> - if (lruvec_holds_page_lru_lock(page, locked_lruvec))
> + if (page_matches_lruvec(page, locked_lruvec))
> return locked_lruvec;
>
> unlock_page_lruvec_irq(locked_lruvec);
> @@ -1518,7 +1517,7 @@ static inline struct lruvec *relock_page_lruvec_irqsave(struct page *page,
> struct lruvec *locked_lruvec, unsigned long *flags)
> {
> if (locked_lruvec) {
> - if (lruvec_holds_page_lru_lock(page, locked_lruvec))
> + if (page_matches_lruvec(page, locked_lruvec))
> return locked_lruvec;
>
> unlock_page_lruvec_irqrestore(locked_lruvec, *flags);
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index bb8321026c0c..2bc5cf409958 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -2062,7 +2062,7 @@ static unsigned noinline_for_stack move_pages_to_lru(struct lruvec *lruvec,
> * All pages were isolated from the same lruvec (and isolation
> * inhibits memcg migration).
> */
> - VM_BUG_ON_PAGE(!lruvec_holds_page_lru_lock(page, lruvec), page);
> + VM_BUG_ON_PAGE(!page_matches_lruvec(page, lruvec), page);
> add_page_to_lru_list(page, lruvec);
> nr_pages = thp_nr_pages(page);
> nr_moved += nr_pages;
> --
> 2.11.0
--
Michal Hocko
SUSE Labs
next prev parent reply other threads:[~2021-04-16 6:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-16 5:13 [PATCH v2 0/8] memcontrol code cleanup and simplification Muchun Song
2021-04-16 5:14 ` [PATCH v2 1/8] mm: memcontrol: fix page charging in page replacement Muchun Song
2021-04-16 5:14 ` [PATCH v2 2/8] mm: memcontrol: bail out early when !mm in get_mem_cgroup_from_mm Muchun Song
2021-04-16 5:14 ` [PATCH v2 3/8] mm: memcontrol: remove the pgdata parameter of mem_cgroup_page_lruvec Muchun Song
2021-04-16 5:14 ` [PATCH v2 4/8] mm: memcontrol: simplify lruvec_holds_page_lru_lock Muchun Song
2021-04-16 5:14 ` [PATCH v2 5/8] mm: memcontrol: rename lruvec_holds_page_lru_lock to page_matches_lruvec Muchun Song
2021-04-16 6:01 ` Michal Hocko [this message]
2021-04-16 15:20 ` Johannes Weiner
2021-04-17 2:52 ` [External] " Muchun Song
2021-04-16 15:34 ` Shakeel Butt
2021-04-16 5:14 ` [PATCH v2 6/8] mm: memcontrol: simplify the logic of objcg pinning memcg Muchun Song
2021-04-16 5:14 ` [PATCH v2 7/8] mm: memcontrol: move obj_cgroup_uncharge_pages() out of css_set_lock Muchun Song
2021-04-16 5:14 ` [PATCH v2 8/8] mm: vmscan: remove noinline_for_stack Muchun Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YHkoJI12iADTAP69@dhcp22.suse.cz \
--to=mhocko@suse.com \
--cc=akpm@linux-foundation.org \
--cc=duanxiongchun@bytedance.com \
--cc=guro@fb.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shakeelb@google.com \
--cc=songmuchun@bytedance.com \
--cc=vdavydov.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox