[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160816143710.GG17417@dhcp22.suse.cz>
Date: Tue, 16 Aug 2016 16:37:10 +0200
From: Michal Hocko <mhocko@...nel.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Brenden Blanco <bblanco@...mgrid.com>,
Johannes Weiner <hannes@...xchg.org>,
Vladimir Davydov <vdavydov@...tuozzo.com>,
linux-kernel@...r.kernel.org,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Alexei Starovoitov <alexei.starovoitov@...il.com>
Subject: Re: uprobes: memory leak in enable/disable loop
On Tue 16-08-16 16:25:12, Oleg Nesterov wrote:
> On 08/16, Oleg Nesterov wrote:
> >
> > On 08/15, Brenden Blanco wrote:
> > >
> > > Hi folks,
> > >
> > > I think I have come across a memory leak in uprobes, which is fairly easy to
> > > reproduce.
> >
> > At first glance this looks as a problem in memcg, add CC's...
> >
> > put_page(old_page) looks properly balanced, and I assume we do not need
> > the additional "uncharge", we can rely on __page_cache_release().
> >
> > And I do not see any leak if I try to reproduce with CONFIG_MEMCG=n.
>
> Heh. it seems that mem_cgroup_*() logic was always wrong in __replace_page().
Yes this seems broken since 00501b531c47 ("mm: memcontrol: rewrite
charge API")
> Could you try the patch below?
The patch looks good to me. Thanks!
> Oleg.
> ---
>
> --- x/kernel/events/uprobes.c
> +++ x/kernel/events/uprobes.c
> @@ -200,7 +200,8 @@ static int __replace_page(struct vm_area
>
> err = 0;
> unlock:
> - mem_cgroup_cancel_charge(kpage, memcg, false);
> + if (err)
> + mem_cgroup_cancel_charge(kpage, memcg, false);
> mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
> unlock_page(page);
> return err;
--
Michal Hocko
SUSE Labs
Powered by blists - more mailing lists