linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Christoph Lameter <cl@linux.com>
Cc: Sasha Levin <sasha.levin@oracle.com>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: Re: mm, vmstat: kernel BUG at mm/vmstat.c:1408!
Date: Thu, 21 Jan 2016 09:24:03 +0100	[thread overview]
Message-ID: <20160121082402.GA29520@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.20.1601201552590.26496@east.gentwo.org>

On Wed 20-01-16 15:57:43, Christoph Lameter wrote:
> On Wed, 20 Jan 2016, Michal Hocko wrote:
> 
> > On Wed 20-01-16 09:55:22, Christoph Lameter wrote:
> > [...]
> > > Subject: vmstat: Remove BUG_ON from vmstat_update
> > >
> > > If we detect that there is nothing to do just set the flag and do not check
> > > if it was already set before. Races really do not matter. If the flag is
> > > set by any code then the shepherd will start dealing with the situation
> > > and reenable the vmstat workers when necessary again.
> > >
> > > Concurrent actions could be onlining and offlining of processors or be a
> > > result of concurrency issues when updating the cpumask from multiple
> > > processors.
> >
> > Now that 7e988032 ("vmstat: make vmstat_updater deferrable again and
> > shut down on idle) is merged the VM_BUG_ON is simply bogus because
> > vmstat_update might "race" with quiet_vmstat. The changelog should
> > reflect that. What about the following wording?
> 
> How can it race if preemption is off?

See below.

> > Since 0eb77e988032 ("vmstat: make vmstat_updater deferrable again and
> > shut down on idle") quiet_vmstat might update cpu_stat_off and mark a
> > particular cpu to be handled by vmstat_shepherd. This might trigger
> > a VM_BUG_ON in vmstat_update because the work item might have been
> > sleeping during the idle period and see the cpu_stat_off updated after
> > the wake up. The VM_BUG_ON is therefore misleading and no more
> > appropriate. Moreover it doesn't really suite any protection from real
> > bugs because vmstat_shepherd will simply reschedule the vmstat_work
> > anytime it sees a particular cpu set or vmstat_update would do the same
> > from the worker context directly. Even when the two would race the
> > result wouldn't be incorrect as the counters update is fully idempotent.
> 
> 
> Hmmm... the vmstat_update can be interrupted while running and the cpu put
> into idle mode? If vmstat_update is running then the cpu is not idle but
> running code. If this is really going on then there is other stuff wrong
> with the idling logic.

The vmstat update might be still waiting for its timer, idle mode started
and kick vmstat_update which might cpumask_test_and_set_cpu. Once the
idle terminates and the originally schedule vmstate_update executes it
sees the bit set and BUG_ON.

> > Fixes: 0eb77e988032 ("vmstat: make vmstat_updater deferrable again and
> > shut down on idle")
> > CC: stable # 4.4+
> 
> ?? There has not been an upstream release with this yet.

Ohh, I thought it made it into 4.4 but you are right it is post 4.4 so
no CC: stable required.

-- 
Michal Hocko
SUSE Labs

  reply	other threads:[~2016-01-21  8:24 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-19  0:33 mm, vmstat: kernel BUG at mm/vmstat.c:1408! Sasha Levin
2015-12-21 13:08 ` Christoph Lameter
2015-12-21 20:28   ` Sasha Levin
2015-12-21 21:07     ` Sasha Levin
2015-12-21 21:14       ` Christoph Lameter
2015-12-22 17:21         ` Christoph Lameter
2015-12-24 20:14         ` Sasha Levin
2015-12-29 17:01           ` Christoph Lameter
2015-12-29 17:18             ` Christoph Lameter
2016-01-04 18:05           ` Christoph Lameter
2016-01-04 18:46             ` Sasha Levin
2016-01-12 11:31   ` Shiraz Hashim
2016-01-12 12:23     ` Christoph Lameter
2016-01-12 12:27       ` Shiraz Hashim
2016-01-13 11:36       ` Shiraz Hashim
2016-01-13 12:32         ` Shiraz Hashim
2016-01-14 21:06         ` Sasha Levin
2016-01-20 14:37 ` Michal Hocko
2016-01-20 14:56   ` Sasha Levin
2016-01-20 15:10     ` Michal Hocko
2016-01-20 15:20       ` Christoph Lameter
2016-01-20 15:49         ` Sasha Levin
2016-01-20 15:55           ` Christoph Lameter
2016-01-20 21:28             ` Michal Hocko
2016-01-20 21:57               ` Christoph Lameter
2016-01-21  8:24                 ` Michal Hocko [this message]
2016-01-21 15:45                   ` Christoph Lameter
2016-01-21 16:51                     ` Michal Hocko
2016-01-21 17:38                       ` Christoph Lameter
2016-01-22 11:00                         ` Shiraz Hashim
2016-01-22 14:04                         ` Michal Hocko
2016-01-22 16:07                           ` Christoph Lameter
2016-01-22 16:12                             ` Michal Hocko
2016-01-22 16:46                               ` Christoph Lameter
2016-01-22 17:12                                 ` Michal Hocko
2016-01-23 16:21                                 ` fast path cycle muncher (vmstat: make vmstat_updater deferrable again and shut down on idle) Mike Galbraith
2016-01-24  0:33                                   ` Christoph Lameter
2016-01-24  2:46                                     ` Mike Galbraith
2016-01-24  3:46                                       ` Christoph Lameter
2016-01-24  5:36                                         ` Mike Galbraith
2016-01-25 17:42                                   ` Michal Hocko
2016-01-25 18:02                                     ` Christoph Lameter
2016-01-25 20:13                                       ` Michal Hocko
2016-01-26 16:25                                         ` Christoph Lameter
2016-01-26 18:31                                           ` Mike Galbraith
2016-01-26 18:34                                             ` Christoph Lameter
2016-01-26 18:45                                               ` Mike Galbraith
2016-01-26 19:20                                                 ` Christoph Lameter
2016-01-27  3:12                                                   ` Mike Galbraith
2016-01-27  4:15                                                     ` Mike Galbraith
2016-01-27 16:28                                                     ` Christoph Lameter
2016-01-28 15:36                                                       ` Frederic Weisbecker
2016-01-28 16:42                                                         ` Christoph Lameter
2016-01-26  2:14                                       ` Mike Galbraith
2016-01-26  2:25                                         ` Mike Galbraith
2016-01-26 16:26                                           ` Christoph Lameter
2016-01-26 17:39                                             ` Mike Galbraith
2016-01-26 18:19                                               ` Christoph Lameter
2016-01-26 16:26                                         ` Christoph Lameter
2016-01-26 17:08                                           ` Mike Galbraith
2016-01-26 18:22                                             ` Christoph Lameter
2016-01-26 19:09                                               ` Mike Galbraith
2016-01-26 19:22                                                 ` Christoph Lameter
2016-01-27 16:48                                   ` [PATCH] mm, vmstat: make quiet_vmstat lighter (was: Re: fast path cycle muncher (vmstat: make vmstat_updater deferrable) " Michal Hocko
2016-01-27 17:03                                     ` Mike Galbraith
2016-01-27 18:26                                     ` Christoph Lameter
2016-01-28 15:21                                       ` Michal Hocko
2016-01-28 16:40                                         ` Christoph Lameter
2016-01-28 16:53                                           ` Michal Hocko
2016-01-28 17:05                                             ` Christoph Lameter
2016-01-28 15:31                                       ` Michal Hocko
2016-01-28 15:37                                         ` [PATCH] vmstat: make vmstat_update deferrable (was: Re: [PATCH] mm, vmstat: make quiet_vmstat lighter) " Michal Hocko
2016-01-28 16:48                                           ` Christoph Lameter
2016-01-28 16:42                                         ` [PATCH] mm, vmstat: make quiet_vmstat lighter (was: Re: fast " Christoph Lameter
2016-01-24 16:57                                 ` mm, vmstat: kernel BUG at mm/vmstat.c:1408! Linus Torvalds
2016-01-20 15:14   ` Christoph Lameter
2016-01-20 15:20     ` 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=20160121082402.GA29520@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=sasha.levin@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).