From: Vladimir Davydov <vdavydov@virtuozzo.com>
To: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom
Date: Tue, 24 May 2016 13:05:23 +0300 [thread overview]
Message-ID: <20160524100523.GJ7917@esperanza> (raw)
In-Reply-To: <20160524092202.GD8259@dhcp22.suse.cz>
On Tue, May 24, 2016 at 11:22:02AM +0200, Michal Hocko wrote:
> On Tue 24-05-16 12:01:42, Vladimir Davydov wrote:
> > On Tue, May 24, 2016 at 10:47:37AM +0200, Michal Hocko wrote:
> > > On Tue 24-05-16 11:43:19, Vladimir Davydov wrote:
> > > > On Mon, May 23, 2016 at 07:44:43PM +0200, Michal Hocko wrote:
> > > > > On Mon 23-05-16 19:02:10, Vladimir Davydov wrote:
> > > > > > mem_cgroup_oom may be invoked multiple times while a process is handling
> > > > > > a page fault, in which case current->memcg_in_oom will be overwritten
> > > > > > leaking the previously taken css reference.
> > > > >
> > > > > Have you seen this happening? I was under impression that the page fault
> > > > > paths that have oom enabled will not retry allocations.
> > > >
> > > > filemap_fault will, for readahead.
> > >
> > > I thought that the readahead is __GFP_NORETRY so we do not trigger OOM
> > > killer.
> >
> > Hmm, interesting. We do allocate readahead pages with __GFP_NORETRY, but
> > we add them to page cache and hence charge with GFP_KERNEL or GFP_NOFS
> > mask, see __do_page_cache_readahaed -> read_pages.
>
> I guess we do not want to trigger OOM just because of readahead. What do
I agree this is how it should ideally work. Not sure if anybody would
bother in practice.
> you think about the following? I will cook up a full patch if this
> (untested) looks ok.
It won't work for most filesystems as they define custom ->readpages. I
wonder if it'd be OK to patch them all not to trigger oom.
--
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: Michal Hocko <mhocko@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Johannes Weiner <hannes@cmpxchg.org>, <linux-mm@kvack.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom
Date: Tue, 24 May 2016 13:05:23 +0300 [thread overview]
Message-ID: <20160524100523.GJ7917@esperanza> (raw)
In-Reply-To: <20160524092202.GD8259@dhcp22.suse.cz>
On Tue, May 24, 2016 at 11:22:02AM +0200, Michal Hocko wrote:
> On Tue 24-05-16 12:01:42, Vladimir Davydov wrote:
> > On Tue, May 24, 2016 at 10:47:37AM +0200, Michal Hocko wrote:
> > > On Tue 24-05-16 11:43:19, Vladimir Davydov wrote:
> > > > On Mon, May 23, 2016 at 07:44:43PM +0200, Michal Hocko wrote:
> > > > > On Mon 23-05-16 19:02:10, Vladimir Davydov wrote:
> > > > > > mem_cgroup_oom may be invoked multiple times while a process is handling
> > > > > > a page fault, in which case current->memcg_in_oom will be overwritten
> > > > > > leaking the previously taken css reference.
> > > > >
> > > > > Have you seen this happening? I was under impression that the page fault
> > > > > paths that have oom enabled will not retry allocations.
> > > >
> > > > filemap_fault will, for readahead.
> > >
> > > I thought that the readahead is __GFP_NORETRY so we do not trigger OOM
> > > killer.
> >
> > Hmm, interesting. We do allocate readahead pages with __GFP_NORETRY, but
> > we add them to page cache and hence charge with GFP_KERNEL or GFP_NOFS
> > mask, see __do_page_cache_readahaed -> read_pages.
>
> I guess we do not want to trigger OOM just because of readahead. What do
I agree this is how it should ideally work. Not sure if anybody would
bother in practice.
> you think about the following? I will cook up a full patch if this
> (untested) looks ok.
It won't work for most filesystems as they define custom ->readpages. I
wonder if it'd be OK to patch them all not to trigger oom.
next prev parent reply other threads:[~2016-05-24 10:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-23 16:02 [PATCH] mm: memcontrol: fix possible css ref leak on oom Vladimir Davydov
2016-05-23 16:02 ` Vladimir Davydov
2016-05-23 17:44 ` Michal Hocko
2016-05-23 17:44 ` Michal Hocko
2016-05-24 8:43 ` Vladimir Davydov
2016-05-24 8:43 ` Vladimir Davydov
2016-05-24 8:47 ` Michal Hocko
2016-05-24 8:47 ` Michal Hocko
2016-05-24 9:01 ` Vladimir Davydov
2016-05-24 9:01 ` Vladimir Davydov
2016-05-24 9:22 ` Michal Hocko
2016-05-24 9:22 ` Michal Hocko
2016-05-24 10:05 ` Vladimir Davydov [this message]
2016-05-24 10:05 ` Vladimir Davydov
2016-05-24 11:31 ` Michal Hocko
2016-05-24 11:31 ` Michal Hocko
2016-05-27 17:36 ` Johannes Weiner
2016-05-27 17:36 ` Johannes Weiner
2016-05-29 9:11 ` Vladimir Davydov
2016-05-29 9:11 ` Vladimir Davydov
2016-05-30 7:26 ` Michal Hocko
2016-05-30 7:26 ` 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=20160524100523.GJ7917@esperanza \
--to=vdavydov@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.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.