[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20190321185453.6458679180e1e41893e7312b@linux-foundation.org>
Date: Thu, 21 Mar 2019 18:54:53 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Johannes Weiner <hannes@...xchg.org>
Cc: Tejun Heo <tj@...nel.org>, Roman Gushchin <guro@...com>,
linux-mm@...ck.org, cgroups@...r.kernel.org,
linux-kernel@...r.kernel.org, kernel-team@...com
Subject: Re: [PATCH 3/6] mm: memcontrol: replace node summing with
memcg_page_state()
On Thu, 28 Feb 2019 11:30:17 -0500 Johannes Weiner <hannes@...xchg.org> wrote:
> Instead of adding up the node counters, use memcg_page_state() to get
> the memcg state directly. This is a bit cheaper and more stream-lined.
>
> ...
>
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -746,10 +746,13 @@ static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg,
> unsigned int lru_mask)
> {
> unsigned long nr = 0;
> - int nid;
> + enum lru_list lru;
>
> - for_each_node_state(nid, N_MEMORY)
> - nr += mem_cgroup_node_nr_lru_pages(memcg, nid, lru_mask);
> + for_each_lru(lru) {
> + if (!(BIT(lru) & lru_mask))
> + continue;
> + nr += memcg_page_state(memcg, NR_LRU_BASE + lru);
> + }
Might be able to use for_each_set_bit(&lru_mnask) here, but it's much
of a muchness.
Powered by blists - more mailing lists