All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rik van Riel <riel-b10kYP2dOMg@public.gmane.org>
To: "shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org"
	<shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Kernel Team <Kernel-team-b10kYP2dOMg@public.gmane.org>,
	"dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org"
	<dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>,
	"hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org"
	<hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	"cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org"
	<linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org"
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [PATCH] mm: memcontrol: fix blocking rstat function called from atomic cgroup1 thresholding code
Date: Tue, 3 Aug 2021 14:34:23 +0000	[thread overview]
Message-ID: <f3bc8b44d58a5e63178dee40f9c119cfc8bf669b.camel@fb.com> (raw)
In-Reply-To: <CALvZod5JmcSpym6oXMXEUXEq2u13SVLRaVGPg84ubeYZt-6w_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tue, 2021-07-27 at 09:51 -0700, Shakeel Butt wrote:
> On Mon, Jul 26, 2021 at 8:19 AM Rik van Riel <riel@fb.com> wrote:
> > 
> > On Mon, 2021-07-26 at 11:00 -0400, Johannes Weiner wrote:
> > > 
> > > __mem_cgroup_threshold() indeed holds the rcu lock. In addition,
> > > the
> > > thresholding code is invoked during stat changes, and those
> > > contexts
> > > have irqs disabled as well. If the lock breaking occurs inside
> > > the
> > > flush function, it will result in a sleep from an atomic context.
> > > 
> > > Use the irsafe flushing variant in mem_cgroup_usage() to fix this
> > 
> > While this fix is necessary, in the long term I think we may
> > want some sort of redesign here, to make sure the irq safe
> > version does not spin long times trying to get the statistics
> > off some other CPU.
> > 
> > I have seen a number of soft (IIRC) lockups deep inside the
> > bowels of cgroup_rstat_flush_irqsafe, with the function taking
> > multiple seconds to complete.
> 
> Can you please share a bit more detail on this lockup? I am wondering
> if this was due to the flush not happening more often and thus the
> update tree is large or if there are too many concurrent flushes
> happening.

I was not logged into any system while it happened, but
only found it later in the logs.

I suspect your explanation is the reason why it happened,
though.


WARNING: multiple messages have this Message-ID (diff)
From: Rik van Riel <riel@fb.com>
To: "shakeelb@google.com" <shakeelb@google.com>
Cc: Kernel Team <Kernel-team@fb.com>,
	"dan.carpenter@oracle.com" <dan.carpenter@oracle.com>,
	"hannes@cmpxchg.org" <hannes@cmpxchg.org>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>
Subject: Re: [PATCH] mm: memcontrol: fix blocking rstat function called from atomic cgroup1 thresholding code
Date: Tue, 3 Aug 2021 14:34:23 +0000	[thread overview]
Message-ID: <f3bc8b44d58a5e63178dee40f9c119cfc8bf669b.camel@fb.com> (raw)
In-Reply-To: <CALvZod5JmcSpym6oXMXEUXEq2u13SVLRaVGPg84ubeYZt-6w_g@mail.gmail.com>

On Tue, 2021-07-27 at 09:51 -0700, Shakeel Butt wrote:
> On Mon, Jul 26, 2021 at 8:19 AM Rik van Riel <riel@fb.com> wrote:
> > 
> > On Mon, 2021-07-26 at 11:00 -0400, Johannes Weiner wrote:
> > > 
> > > __mem_cgroup_threshold() indeed holds the rcu lock. In addition,
> > > the
> > > thresholding code is invoked during stat changes, and those
> > > contexts
> > > have irqs disabled as well. If the lock breaking occurs inside
> > > the
> > > flush function, it will result in a sleep from an atomic context.
> > > 
> > > Use the irsafe flushing variant in mem_cgroup_usage() to fix this
> > 
> > While this fix is necessary, in the long term I think we may
> > want some sort of redesign here, to make sure the irq safe
> > version does not spin long times trying to get the statistics
> > off some other CPU.
> > 
> > I have seen a number of soft (IIRC) lockups deep inside the
> > bowels of cgroup_rstat_flush_irqsafe, with the function taking
> > multiple seconds to complete.
> 
> Can you please share a bit more detail on this lockup? I am wondering
> if this was due to the flush not happening more often and thus the
> update tree is large or if there are too many concurrent flushes
> happening.

I was not logged into any system while it happened, but
only found it later in the logs.

I suspect your explanation is the reason why it happened,
though.


  parent reply	other threads:[~2021-08-03 14:34 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-26 15:00 [PATCH] mm: memcontrol: fix blocking rstat function called from atomic cgroup1 thresholding code Johannes Weiner
2021-07-26 15:00 ` Johannes Weiner
     [not found] ` <20210726150019.251820-1-hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
2021-07-26 15:08   ` Chris Down
2021-07-26 15:08     ` Chris Down
2021-07-26 15:16   ` Rik van Riel
2021-07-26 15:16     ` Rik van Riel
     [not found]     ` <2b0b08f9385b25fb7750dbe453516b0c8bb27604.camel-b10kYP2dOMg@public.gmane.org>
2021-07-27 16:51       ` Shakeel Butt
2021-07-27 16:51         ` Shakeel Butt
     [not found]         ` <CALvZod5JmcSpym6oXMXEUXEq2u13SVLRaVGPg84ubeYZt-6w_g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2021-08-03 14:34           ` Rik van Riel [this message]
2021-08-03 14:34             ` Rik van Riel
2021-07-27 16:59   ` Shakeel Butt
2021-07-27 16:59     ` Shakeel Butt
2021-07-26 20:32 ` Michal Hocko

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=f3bc8b44d58a5e63178dee40f9c119cfc8bf669b.camel@fb.com \
    --to=riel-b10kyp2domg@public.gmane.org \
    --cc=Kernel-team-b10kYP2dOMg@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    /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.