Re: [PATCH 3/6] mm: memcontrol: replace node summing with memcg_page_state()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 28 Feb 2019 11:30:17 -0500 Johannes Weiner <hannes@xxxxxxxxxxx> 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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux