All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Tejun Heo <tj@kernel.org>,
	<cgroups@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-mm@kvack.org>
Subject: Re: [patch -mm] mm, memcg: evaluate root and leaf memcgs fairly on oom
Date: Thu, 15 Mar 2018 16:46:53 +0000	[thread overview]
Message-ID: <20180315164646.GA1853@castle.DHCP.thefacebook.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1803141337110.163553@chino.kir.corp.google.com>

On Wed, Mar 14, 2018 at 01:41:03PM -0700, David Rientjes wrote:
> On Wed, 14 Mar 2018, Roman Gushchin wrote:
> 
> > > @@ -2618,92 +2620,65 @@ static long memcg_oom_badness(struct mem_cgroup *memcg,
> > >  		if (nodemask && !node_isset(nid, *nodemask))
> > >  			continue;
> > >  
> > > -		points += mem_cgroup_node_nr_lru_pages(memcg, nid,
> > > -				LRU_ALL_ANON | BIT(LRU_UNEVICTABLE));
> > > -
> > >  		pgdat = NODE_DATA(nid);
> > > -		points += lruvec_page_state(mem_cgroup_lruvec(pgdat, memcg),
> > > -					    NR_SLAB_UNRECLAIMABLE);
> > > +		if (is_root_memcg) {
> > > +			points += node_page_state(pgdat, NR_ACTIVE_ANON) +
> > > +				  node_page_state(pgdat, NR_INACTIVE_ANON);
> > > +			points += node_page_state(pgdat, NR_SLAB_UNRECLAIMABLE);
> > > +		} else {
> > > +			points += mem_cgroup_node_nr_lru_pages(memcg, nid,
> > > +							       LRU_ALL_ANON);
> > > +			points += lruvec_page_state(mem_cgroup_lruvec(pgdat, memcg),
> > > +						    NR_SLAB_UNRECLAIMABLE);
> > > +		}
> > >  	}
> > >  
> > > -	points += memcg_page_state(memcg, MEMCG_KERNEL_STACK_KB) /
> > > -		(PAGE_SIZE / 1024);
> > > -	points += memcg_page_state(memcg, MEMCG_SOCK);
> > > -	points += memcg_page_state(memcg, MEMCG_SWAP);
> > > -
> > > +	if (is_root_memcg) {
> > > +		points += global_zone_page_state(NR_KERNEL_STACK_KB) /
> > > +				(PAGE_SIZE / 1024);
> > > +		points += atomic_long_read(&total_sock_pages);
> >                                             ^^^^^^^^^^^^^^^^
> > BTW, where do we change this counter?
> > 
> 
> Seems like it was dropped from the patch somehow.  It is intended to do 
> atomic_long_add(nr_pages) in mem_cgroup_charge_skmem() and 
> atomic_long_add(-nr_pages) mem_cgroup_uncharge_skmem().
> 
> > I also doubt that global atomic variable can work here,
> > we probably need something better scaling.
> > 
> 
> Why do you think an atomic_long_add() is too expensive when we're already 
> disabling irqs and dong try_charge()?

Hard to say without having full code :)
try_charge() is batched, if you'll batch it too, it will probably work.

WARNING: multiple messages have this Message-ID (diff)
From: Roman Gushchin <guro@fb.com>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,
	Vladimir Davydov <vdavydov.dev@gmail.com>,
	Johannes Weiner <hannes@cmpxchg.org>, Tejun Heo <tj@kernel.org>,
	cgroups@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org
Subject: Re: [patch -mm] mm, memcg: evaluate root and leaf memcgs fairly on oom
Date: Thu, 15 Mar 2018 16:46:53 +0000	[thread overview]
Message-ID: <20180315164646.GA1853@castle.DHCP.thefacebook.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1803141337110.163553@chino.kir.corp.google.com>

On Wed, Mar 14, 2018 at 01:41:03PM -0700, David Rientjes wrote:
> On Wed, 14 Mar 2018, Roman Gushchin wrote:
> 
> > > @@ -2618,92 +2620,65 @@ static long memcg_oom_badness(struct mem_cgroup *memcg,
> > >  		if (nodemask && !node_isset(nid, *nodemask))
> > >  			continue;
> > >  
> > > -		points += mem_cgroup_node_nr_lru_pages(memcg, nid,
> > > -				LRU_ALL_ANON | BIT(LRU_UNEVICTABLE));
> > > -
> > >  		pgdat = NODE_DATA(nid);
> > > -		points += lruvec_page_state(mem_cgroup_lruvec(pgdat, memcg),
> > > -					    NR_SLAB_UNRECLAIMABLE);
> > > +		if (is_root_memcg) {
> > > +			points += node_page_state(pgdat, NR_ACTIVE_ANON) +
> > > +				  node_page_state(pgdat, NR_INACTIVE_ANON);
> > > +			points += node_page_state(pgdat, NR_SLAB_UNRECLAIMABLE);
> > > +		} else {
> > > +			points += mem_cgroup_node_nr_lru_pages(memcg, nid,
> > > +							       LRU_ALL_ANON);
> > > +			points += lruvec_page_state(mem_cgroup_lruvec(pgdat, memcg),
> > > +						    NR_SLAB_UNRECLAIMABLE);
> > > +		}
> > >  	}
> > >  
> > > -	points += memcg_page_state(memcg, MEMCG_KERNEL_STACK_KB) /
> > > -		(PAGE_SIZE / 1024);
> > > -	points += memcg_page_state(memcg, MEMCG_SOCK);
> > > -	points += memcg_page_state(memcg, MEMCG_SWAP);
> > > -
> > > +	if (is_root_memcg) {
> > > +		points += global_zone_page_state(NR_KERNEL_STACK_KB) /
> > > +				(PAGE_SIZE / 1024);
> > > +		points += atomic_long_read(&total_sock_pages);
> >                                             ^^^^^^^^^^^^^^^^
> > BTW, where do we change this counter?
> > 
> 
> Seems like it was dropped from the patch somehow.  It is intended to do 
> atomic_long_add(nr_pages) in mem_cgroup_charge_skmem() and 
> atomic_long_add(-nr_pages) mem_cgroup_uncharge_skmem().
> 
> > I also doubt that global atomic variable can work here,
> > we probably need something better scaling.
> > 
> 
> Why do you think an atomic_long_add() is too expensive when we're already 
> disabling irqs and dong try_charge()?

Hard to say without having full code :)
try_charge() is batched, if you'll batch it too, it will probably work.

  reply	other threads:[~2018-03-15 16:47 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-13  0:57 [patch -mm v3 0/3] mm, memcg: introduce oom policies David Rientjes
2018-03-13  0:57 ` [patch -mm v3 1/3] mm, memcg: introduce per-memcg oom policy tunable David Rientjes
2018-03-14 12:38   ` Roman Gushchin
2018-03-14 12:38     ` Roman Gushchin
2018-03-14 12:38     ` Roman Gushchin
2018-03-14 20:58     ` David Rientjes
2018-03-15 17:10       ` Roman Gushchin
2018-03-15 17:10         ` Roman Gushchin
2018-03-15 20:16         ` David Rientjes
2018-03-13  0:57 ` [patch -mm v3 2/3] mm, memcg: replace cgroup aware oom killer mount option with tunable David Rientjes
2018-03-13  0:57 ` [patch -mm v3 3/3] mm, memcg: add hierarchical usage oom policy David Rientjes
2018-03-14  0:21 ` [patch -mm] mm, memcg: evaluate root and leaf memcgs fairly on oom David Rientjes
2018-03-14 12:17   ` Roman Gushchin
2018-03-14 12:17     ` Roman Gushchin
2018-03-14 20:41     ` David Rientjes
2018-03-15 16:46       ` Roman Gushchin [this message]
2018-03-15 16:46         ` Roman Gushchin
2018-03-15 20:01         ` David Rientjes
2018-03-15 20:34   ` [patch -mm] mm, memcg: separate oom_group from selection criteria David Rientjes
2018-03-15 20:51   ` [patch -mm] mm, memcg: disregard mempolicies for cgroup-aware oom killer David Rientjes
2018-03-15 20:54 ` [patch -mm v3 0/3] mm, memcg: introduce oom policies David Rientjes
2018-03-16 21:08   ` [patch -mm 0/6] rewrite cgroup aware oom killer for general use David Rientjes
2018-03-16 21:08     ` [patch -mm 1/6] mm, memcg: introduce per-memcg oom policy tunable David Rientjes
2018-03-16 21:08     ` [patch -mm 2/6] mm, memcg: replace cgroup aware oom killer mount option with tunable David Rientjes
2018-03-16 21:08     ` [patch -mm 3/6] mm, memcg: add hierarchical usage oom policy David Rientjes
2018-03-16 21:08     ` [patch -mm 4/6] mm, memcg: evaluate root and leaf memcgs fairly on oom David Rientjes
2018-03-18 15:00       ` kbuild test robot
2018-03-18 20:14         ` [patch -mm 4/6 updated] " David Rientjes
2018-03-18 18:18       ` [patch -mm 4/6] " kbuild test robot
2018-03-16 21:08     ` [patch -mm 5/6] mm, memcg: separate oom_group from selection criteria David Rientjes
2018-03-16 21:08     ` [patch -mm 6/6] mm, memcg: disregard mempolicies for cgroup-aware oom killer David Rientjes
2018-03-22 21:53     ` [patch v2 -mm 0/6] rewrite cgroup aware oom killer for general use David Rientjes
2018-03-22 21:53       ` [patch v2 -mm 1/6] mm, memcg: introduce per-memcg oom policy tunable David Rientjes
2018-03-22 21:53       ` [patch v2 -mm 2/6] mm, memcg: replace cgroup aware oom killer mount option with tunable David Rientjes
2018-03-22 21:53       ` [patch v2 -mm 3/6] mm, memcg: add hierarchical usage oom policy David Rientjes
2018-03-22 21:53       ` [patch v2 -mm 4/6] mm, memcg: evaluate root and leaf memcgs fairly on oom David Rientjes
2018-03-22 21:53       ` [patch v2 -mm 5/6] mm, memcg: separate oom_group from selection criteria David Rientjes
2018-03-22 21:53       ` [patch v2 -mm 6/6] mm, memcg: disregard mempolicies for cgroup-aware oom killer David Rientjes
2018-07-13 23:07       ` [patch v3 -mm 0/6] rewrite cgroup aware oom killer for general use David Rientjes
2018-07-13 23:07         ` [patch v3 -mm 1/6] mm, memcg: introduce per-memcg oom policy tunable David Rientjes
2018-07-13 23:07         ` [patch v3 -mm 2/6] mm, memcg: replace cgroup aware oom killer mount option with tunable David Rientjes
2018-07-13 23:07         ` [patch v3 -mm 3/6] mm, memcg: add hierarchical usage oom policy David Rientjes
2018-07-16 18:16           ` Roman Gushchin
2018-07-16 18:16             ` Roman Gushchin
2018-07-17  4:06             ` David Rientjes
2018-07-23 20:33               ` David Rientjes
2018-07-23 21:28                 ` Roman Gushchin
2018-07-23 21:28                   ` Roman Gushchin
2018-07-23 23:22                   ` David Rientjes
2018-07-13 23:07         ` [patch v3 -mm 4/6] mm, memcg: evaluate root and leaf memcgs fairly on oom David Rientjes
2018-07-13 23:07         ` [patch v3 -mm 5/6] mm, memcg: separate oom_group from selection criteria David Rientjes
2018-07-13 23:07         ` [patch v3 -mm 6/6] mm, memcg: disregard mempolicies for cgroup-aware oom killer David Rientjes

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=20180315164646.GA1853@castle.DHCP.thefacebook.com \
    --to=guro@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=rientjes@google.com \
    --cc=tj@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.