Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1559568
| From | Michal Hocko <mhocko@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check |
| Date | 2017-01-16 11:00 +0100 |
| Message-ID | <t0ceZ-71a-3@gated-at.bofh.it> (permalink) |
| References | <t0bCi-6HI-19@gated-at.bofh.it> <t0bLY-6Q2-9@gated-at.bofh.it> <t0bVE-6TE-27@gated-at.bofh.it> <t0c5j-6Xo-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon 16-01-17 11:48:51, Leon Romanovsky wrote:
> On Mon, Jan 16, 2017 at 10:37:02AM +0100, Borislav Petkov wrote:
> > On Mon, Jan 16, 2017 at 11:28:40AM +0200, Leon Romanovsky wrote:
> > > On Mon, Jan 16, 2017 at 10:16:43AM +0100, Borislav Petkov wrote:
> > > > From: Borislav Petkov <bp@suse.de>
> > > >
> > > > We wanna know who's doing such a thing. Like slab.c does that.
> > > >
> > > > Signed-off-by: Borislav Petkov <bp@suse.de>
> > > > ---
> > > > mm/slub.c | 1 +
> > > > 1 file changed, 1 insertion(+)
> > > >
> > > > diff --git a/mm/slub.c b/mm/slub.c
> > > > index 067598a00849..1b0fa7625d6d 100644
> > > > --- a/mm/slub.c
> > > > +++ b/mm/slub.c
> > > > @@ -1623,6 +1623,7 @@ static struct page *new_slab(struct kmem_cache *s, gfp_t flags, int node)
> > > > flags &= ~GFP_SLAB_BUG_MASK;
> > > > pr_warn("Unexpected gfp: %#x (%pGg). Fixing up to gfp: %#x (%pGg). Fix your code!\n",
> > > > invalid_mask, &invalid_mask, flags, &flags);
> > > > + dump_stack();
> > >
> > > Will it make sense to change these two lines above to WARN(true, .....)?
> >
> > Should be equivalent.
>
> Almost, except one point - pr_warn and dump_stack have different log
> levels. There is a chance that user won't see pr_warn message above, but
> dump_stack will be always present.
>
> For WARN_XXX, users will always see message and stack at the same time.
On the other hand WARN* will taint the kernel and this sounds a bit
overreacting for something like a wrong gfp mask which is perfectly
recoverable. Not to mention users who care configured to panic on
warning.
So while I do not have a strong opinion on this I would rather stay with
the dump_stack.
--
Michal Hocko
SUSE Labs
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Borislav Petkov <bp@alien8.de> - 2017-01-16 10:20 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Leon Romanovsky <leon@kernel.org> - 2017-01-16 10:30 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Borislav Petkov <bp@alien8.de> - 2017-01-16 10:40 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Leon Romanovsky <leon@kernel.org> - 2017-01-16 10:50 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Michal Hocko <mhocko@kernel.org> - 2017-01-16 11:00 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Borislav Petkov <bp@alien8.de> - 2017-01-16 11:00 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Leon Romanovsky <leon@kernel.org> - 2017-01-16 11:20 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Leon Romanovsky <leon@kernel.org> - 2017-01-16 11:20 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Borislav Petkov <bp@alien8.de> - 2017-01-16 11:20 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Michal Hocko <mhocko@kernel.org> - 2017-01-16 10:40 +0100
Re: [PATCH] mm/slub: Add a dump_stack() to the unexpected GFP check Vlastimil Babka <vbabka@suse.cz> - 2017-01-16 11:10 +0100
csiph-web