Re: [PATCHv2] kmemleak: Add option to print warnings to dmesg

From: Catalin Marinas
Date: Tue Aug 28 2018 - 06:26:29 EST


On Tue, Aug 28, 2018 at 12:14:12PM +0200, Vincent Whitchurch wrote:
> On Mon, Aug 27, 2018 at 03:16:41PM -0700, Andrew Morton wrote:
> > On Mon, 27 Aug 2018 10:38:21 +0200 Vincent Whitchurch <vincent.whitchurch@xxxxxxxx> wrote:
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -593,6 +593,15 @@ config DEBUG_KMEMLEAK_DEFAULT_OFF
> > > Say Y here to disable kmemleak by default. It can then be enabled
> > > on the command line via kmemleak=on.
> > >
> > > +config DEBUG_KMEMLEAK_WARN
> > > + bool "Print kmemleak object warnings to log buffer"
> > > + depends on DEBUG_KMEMLEAK
> > > + help
> > > + Say Y here to make kmemleak print information about unreferenced
> > > + objects (including stacktraces) as warnings to the kernel log buffer.
> > > + Otherwise this information is only available by reading the kmemleak
> > > + debugfs file.
> >
> > Why add the config option? Why not simply make the change for all
> > configs?
>
> No particular reason other than preserving the current behaviour for
> existing users. I can remove the config option if Catalin is fine with
> it.

IIRC, in the early kmemleak days, people complained about it being to
noisy (the false positives rate was also much higher), so the default
behaviour was changed to monitor (almost) quietly with the details
available via debugfs. I'd like to keep this default behaviour but we
could have a "verbose" command via both debugfs and kernel parameter (as
we do with "off" and "on"). Would this work for you?

--
Catalin