[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <482146467.19754107.1524649841393.JavaMail.zimbra@redhat.com>
Date: Wed, 25 Apr 2018 05:50:41 -0400 (EDT)
From: Chunyu Hu <chuhu@...hat.com>
To: Catalin Marinas <catalin.marinas@....com>
Cc: Michal Hocko <mhocko@...nel.org>,
Chunyu Hu <chuhu.ncepu@...il.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
LKML <linux-kernel@...r.kernel.org>,
Linux-MM <linux-mm@...ck.org>
Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in
gfp_kmemleak_mask
----- Original Message -----
> From: "Catalin Marinas" <catalin.marinas@....com>
> To: "Michal Hocko" <mhocko@...nel.org>
> Cc: "Chunyu Hu" <chuhu.ncepu@...il.com>, "Dmitry Vyukov" <dvyukov@...gle.com>, "Chunyu Hu" <chuhu@...hat.com>, "LKML"
> <linux-kernel@...r.kernel.org>, "Linux-MM" <linux-mm@...ck.org>
> Sent: Tuesday, April 24, 2018 9:41:48 PM
> Subject: Re: [RFC] mm: kmemleak: replace __GFP_NOFAIL to GFP_NOWAIT in gfp_kmemleak_mask
>
> On Tue, Apr 24, 2018 at 07:20:57AM -0600, Michal Hocko wrote:
> > On Mon 23-04-18 12:17:32, Chunyu Hu wrote:
> > [...]
> > > So if there is a new flag, it would be the 25th bits.
> >
> > No new flags please. Can you simply store a simple bool into
> > fail_page_alloc
> > and have save/restore api for that?
>
> For kmemleak, we probably first hit failslab. Something like below may
> do the trick:
>
> diff --git a/mm/failslab.c b/mm/failslab.c
> index 1f2f248e3601..63f13da5cb47 100644
> --- a/mm/failslab.c
> +++ b/mm/failslab.c
> @@ -29,6 +29,9 @@ bool __should_failslab(struct kmem_cache *s, gfp_t
> gfpflags)
> if (failslab.cache_filter && !(s->flags & SLAB_FAILSLAB))
> return false;
>
> + if (s->flags & SLAB_NOLEAKTRACE)
> + return false;
> +
> return should_fail(&failslab.attr, s->object_size);
> }
This maybe is the easy enough way for skipping fault injection for kmemleak slab object.
>
>
> Can we get a second should_fail() via should_fail_alloc_page() if a new
> slab page is allocated?
looking at code path blow, what do you mean by getting a second should_fail() via
fail_alloc_page? Seems we need to insert the flag between alloc_slab_page and
alloc_pages()? Without GFP flag, it's difficult to pass info to should_fail_alloc_page
and keep simple at same time.
Or as Michal suggested, completely disabling page alloc fail injection when kmemleak
enabled. And enable it again when kmemleak off.
alloc_slab_page
<========= flag to change the behavior of should_fail_alloc_page
alloc_pages
alloc_pages_current
__alloc_pages_nodemask
prepare_alloc_pages
should_fail_alloc_page
>
> --
> Catalin
>
--
Regards,
Chunyu Hu
Powered by blists - more mailing lists