[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160524100523.GJ7917@esperanza>
Date: Tue, 24 May 2016 13:05:23 +0300
From: Vladimir Davydov <vdavydov@...tuozzo.com>
To: Michal Hocko <mhocko@...nel.org>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Johannes Weiner <hannes@...xchg.org>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: memcontrol: fix possible css ref leak on oom
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.
Powered by blists - more mailing lists