From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Minchan Kim <minchan@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>
Subject: Re: [BUG] Bad page states
Date: Mon, 8 Aug 2016 21:37:54 +0300 [thread overview]
Message-ID: <20160808183754.GE1983@esperanza> (raw)
In-Reply-To: <CA+55aFzYnpS-kc+=R0HvTuFquV2qH6cqBXF0-0Q2rSCk=6nUUA@mail.gmail.com>
On Mon, Aug 08, 2016 at 10:48:45AM -0700, Linus Torvalds wrote:
...
> > [ 43.477693] BUG: Bad page state in process S05containers pfn:1ff02a3
> > [ 43.484417] page:ffffea007fc0a8c0 count:0 mapcount:-511 mapping: (null) index:0x0
> > [ 43.492737] flags: 0x1000000000000000()
> > [ 43.496602] page dumped because: nonzero mapcount
>
> Hmm. The _mapcount field is a union with other fields, but that number
> doesn't make sense for any of the other fields.
>
> So it's almost certainly related to "PAGE_KMEMCG_MAPCOUNT_VALUE". So
Yes, it is - my bad. The thing is I set/clear PAGE_KMEMCG_MAPCOUNT_VALUE
for pages allocated with __GFP_ACCOUNT iff memcg_kmem_enabled() is true
(see __alloc_pages_nodemask and free_pages_prepare), while the latter
gets disabled when the last cgroup gets destroyed. So if you do
mkdir /sys/fs/cgroup/memory/test
# run something in the root cgroup that allocates pages with
# __GFP_ACCOUNT, e.g. a program using pipe
rmdir /sys/fs/cgroup/memory/test
Then, if there are no other memory cgroups, you'll see the bug.
Sorry about that :-(
Obviously, the PageKmemcg flag should only be set for pages that are
actually accounted to a non-root kmemcg and hence pin memcg_kmem_enabled
static key. I'll fix that.
Thanks,
Vladimir
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
linux-mm <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Minchan Kim <minchan@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Michal Hocko <mhocko@kernel.org>
Subject: Re: [BUG] Bad page states
Date: Mon, 8 Aug 2016 21:37:54 +0300 [thread overview]
Message-ID: <20160808183754.GE1983@esperanza> (raw)
In-Reply-To: <CA+55aFzYnpS-kc+=R0HvTuFquV2qH6cqBXF0-0Q2rSCk=6nUUA@mail.gmail.com>
On Mon, Aug 08, 2016 at 10:48:45AM -0700, Linus Torvalds wrote:
...
> > [ 43.477693] BUG: Bad page state in process S05containers pfn:1ff02a3
> > [ 43.484417] page:ffffea007fc0a8c0 count:0 mapcount:-511 mapping: (null) index:0x0
> > [ 43.492737] flags: 0x1000000000000000()
> > [ 43.496602] page dumped because: nonzero mapcount
>
> Hmm. The _mapcount field is a union with other fields, but that number
> doesn't make sense for any of the other fields.
>
> So it's almost certainly related to "PAGE_KMEMCG_MAPCOUNT_VALUE". So
Yes, it is - my bad. The thing is I set/clear PAGE_KMEMCG_MAPCOUNT_VALUE
for pages allocated with __GFP_ACCOUNT iff memcg_kmem_enabled() is true
(see __alloc_pages_nodemask and free_pages_prepare), while the latter
gets disabled when the last cgroup gets destroyed. So if you do
mkdir /sys/fs/cgroup/memory/test
# run something in the root cgroup that allocates pages with
# __GFP_ACCOUNT, e.g. a program using pipe
rmdir /sys/fs/cgroup/memory/test
Then, if there are no other memory cgroups, you'll see the bug.
Sorry about that :-(
Obviously, the PageKmemcg flag should only be set for pages that are
actually accounted to a non-root kmemcg and hence pin memcg_kmem_enabled
static key. I'll fix that.
Thanks,
Vladimir
next prev parent reply other threads:[~2016-08-08 18:38 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-05 17:13 [BUG] Bad page states Eric Dumazet
2016-08-08 17:48 ` Linus Torvalds
2016-08-08 17:48 ` Linus Torvalds
2016-08-08 18:37 ` Vladimir Davydov [this message]
2016-08-08 18:37 ` Vladimir Davydov
2016-08-08 20:03 ` [PATCH] mm: memcontrol: only mark charged pages with PageKmemcg Vladimir Davydov
2016-08-08 20:03 ` Vladimir Davydov
2016-08-08 20:03 ` Vladimir Davydov
2016-08-08 21:20 ` Linus Torvalds
2016-08-08 21:20 ` Linus Torvalds
2016-08-09 16:58 ` Eric Dumazet
2016-08-09 16:58 ` Eric Dumazet
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=20160808183754.GE1983@esperanza \
--to=vdavydov@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=eric.dumazet@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=torvalds@linux-foundation.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.