[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.LSU.2.11.2009211434490.5214@eggly.anvils>
Date: Mon, 21 Sep 2020 14:36:52 -0700 (PDT)
From: Hugh Dickins <hughd@...gle.com>
To: Alex Shi <alex.shi@...ux.alibaba.com>
cc: akpm@...ux-foundation.org, mgorman@...hsingularity.net,
tj@...nel.org, hughd@...gle.com, khlebnikov@...dex-team.ru,
daniel.m.jordan@...cle.com, willy@...radead.org,
hannes@...xchg.org, lkp@...el.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org, cgroups@...r.kernel.org,
shakeelb@...gle.com, iamjoonsoo.kim@....com,
richard.weiyang@...il.com, kirill@...temov.name,
alexander.duyck@...il.com, rong.a.chen@...el.com, mhocko@...e.com,
vdavydov.dev@...il.com, shy828301@...il.com
Subject: Re: [PATCH v18 15/32] mm/lru: move lock into lru_note_cost
On Mon, 24 Aug 2020, Alex Shi wrote:
> We have to move lru_lock into lru_note_cost, since it cycle up on memcg
> tree, for future per lruvec lru_lock replace. It's a bit ugly and may
> cost a bit more locking, but benefit from multiple memcg locking could
> cover the lost.
>
> Signed-off-by: Alex Shi <alex.shi@...ux.alibaba.com>
Acked-by: Hugh Dickins <hughd@...gle.com>
In your lruv19 github tree, you have merged 14/32 into this one: thanks.
> Cc: Johannes Weiner <hannes@...xchg.org>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: linux-mm@...ck.org
> Cc: linux-kernel@...r.kernel.org
> ---
> mm/swap.c | 5 +++--
> mm/vmscan.c | 4 +---
> 2 files changed, 4 insertions(+), 5 deletions(-)
>
> diff --git a/mm/swap.c b/mm/swap.c
> index 906255db6006..f80ccd6f3cb4 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -269,7 +269,9 @@ void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages)
> {
> do {
> unsigned long lrusize;
> + struct pglist_data *pgdat = lruvec_pgdat(lruvec);
>
> + spin_lock_irq(&pgdat->lru_lock);
> /* Record cost event */
> if (file)
> lruvec->file_cost += nr_pages;
> @@ -293,15 +295,14 @@ void lru_note_cost(struct lruvec *lruvec, bool file, unsigned int nr_pages)
> lruvec->file_cost /= 2;
> lruvec->anon_cost /= 2;
> }
> + spin_unlock_irq(&pgdat->lru_lock);
> } while ((lruvec = parent_lruvec(lruvec)));
> }
>
> void lru_note_cost_page(struct page *page)
> {
> - spin_lock_irq(&page_pgdat(page)->lru_lock);
> lru_note_cost(mem_cgroup_page_lruvec(page, page_pgdat(page)),
> page_is_file_lru(page), thp_nr_pages(page));
> - spin_unlock_irq(&page_pgdat(page)->lru_lock);
> }
>
> static void __activate_page(struct page *page, struct lruvec *lruvec)
> diff --git a/mm/vmscan.c b/mm/vmscan.c
> index ffccb94defaf..7b7b36bd1448 100644
> --- a/mm/vmscan.c
> +++ b/mm/vmscan.c
> @@ -1971,19 +1971,17 @@ static int current_may_throttle(void)
> &stat, false);
>
> spin_lock_irq(&pgdat->lru_lock);
> -
> move_pages_to_lru(lruvec, &page_list);
>
> __mod_node_page_state(pgdat, NR_ISOLATED_ANON + file, -nr_taken);
> - lru_note_cost(lruvec, file, stat.nr_pageout);
> item = current_is_kswapd() ? PGSTEAL_KSWAPD : PGSTEAL_DIRECT;
> if (!cgroup_reclaim(sc))
> __count_vm_events(item, nr_reclaimed);
> __count_memcg_events(lruvec_memcg(lruvec), item, nr_reclaimed);
> __count_vm_events(PGSTEAL_ANON + file, nr_reclaimed);
> -
> spin_unlock_irq(&pgdat->lru_lock);
>
> + lru_note_cost(lruvec, file, stat.nr_pageout);
> mem_cgroup_uncharge_list(&page_list);
> free_unref_page_list(&page_list);
>
> --
> 1.8.3.1
>
>
Powered by blists - more mailing lists