diff mbox series

[v2,1/4] slub: Restore slub_debug=- behavior

Message ID 20210526025625.601023-2-swboyd@chromium.org (mailing list archive)
State New, archived
Headers show
Series slub: Print non-hashed pointers in slub debugging | expand

Commit Message

Stephen Boyd May 26, 2021, 2:56 a.m. UTC
Passing slub_debug=- on the kernel commandline is supposed to disable
slub debugging. This is especially useful with CONFIG_SLUB_DEBUG_ON
where the default is to have slub debugging enabled in the build. Due to
some code reorganization this behavior was dropped, but the code to make
it work mostly stuck around. Restore the previous behavior by disabling
the static key when we parse the commandline and see that we're trying
to disable slub debugging.

Cc: Vlastimil Babka <vbabka@suse.cz>
Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks")
Signed-off-by: Stephen Boyd <swboyd@chromium.org>
---
 mm/slub.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Muchun Song May 26, 2021, 4:04 a.m. UTC | #1
On Wed, May 26, 2021 at 10:56 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Passing slub_debug=- on the kernel commandline is supposed to disable
> slub debugging. This is especially useful with CONFIG_SLUB_DEBUG_ON
> where the default is to have slub debugging enabled in the build. Due to
> some code reorganization this behavior was dropped, but the code to make
> it work mostly stuck around. Restore the previous behavior by disabling
> the static key when we parse the commandline and see that we're trying
> to disable slub debugging.
>
> Cc: Vlastimil Babka <vbabka@suse.cz>
> Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks")

Is it caused by the commit ca0cab65ea2b ("mm, slub: introduce static
key for slub_debug()")?

> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
> ---
>  mm/slub.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index 438fa8d4c970..2f53e8a9c28e 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1396,6 +1396,8 @@ static int __init setup_slub_debug(char *str)
>  out:
>         if (slub_debug != 0 || slub_debug_string)
>                 static_branch_enable(&slub_debug_enabled);
> +       else
> +               static_branch_disable(&slub_debug_enabled);
>         if ((static_branch_unlikely(&init_on_alloc) ||
>              static_branch_unlikely(&init_on_free)) &&
>             (slub_debug & SLAB_POISON))
> --
> https://chromeos.dev
>
Vlastimil Babka May 26, 2021, 10:39 a.m. UTC | #2
On 5/26/21 6:04 AM, Muchun Song wrote:
> On Wed, May 26, 2021 at 10:56 AM Stephen Boyd <swboyd@chromium.org> wrote:
>>
>> Passing slub_debug=- on the kernel commandline is supposed to disable
>> slub debugging. This is especially useful with CONFIG_SLUB_DEBUG_ON
>> where the default is to have slub debugging enabled in the build. Due to
>> some code reorganization this behavior was dropped, but the code to make
>> it work mostly stuck around. Restore the previous behavior by disabling
>> the static key when we parse the commandline and see that we're trying
>> to disable slub debugging.
>>
>> Cc: Vlastimil Babka <vbabka@suse.cz>
>> Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks")

Acked-by: Vlastimil Babka <vbabka@suse.cz>

> 
> Is it caused by the commit ca0cab65ea2b ("mm, slub: introduce static
> key for slub_debug()")?

Yep, looks like a better Fixes: candidate.

>> Signed-off-by: Stephen Boyd <swboyd@chromium.org>
>> ---
>>  mm/slub.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/mm/slub.c b/mm/slub.c
>> index 438fa8d4c970..2f53e8a9c28e 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -1396,6 +1396,8 @@ static int __init setup_slub_debug(char *str)
>>  out:
>>         if (slub_debug != 0 || slub_debug_string)
>>                 static_branch_enable(&slub_debug_enabled);
>> +       else
>> +               static_branch_disable(&slub_debug_enabled);
>>         if ((static_branch_unlikely(&init_on_alloc) ||
>>              static_branch_unlikely(&init_on_free)) &&
>>             (slub_debug & SLAB_POISON))
>> --
>> https://chromeos.dev
>>
>
Stephen Boyd May 26, 2021, 8:20 p.m. UTC | #3
Quoting Vlastimil Babka (2021-05-26 03:39:54)
> On 5/26/21 6:04 AM, Muchun Song wrote:
> > On Wed, May 26, 2021 at 10:56 AM Stephen Boyd <swboyd@chromium.org> wrote:
> >>
> >> Passing slub_debug=- on the kernel commandline is supposed to disable
> >> slub debugging. This is especially useful with CONFIG_SLUB_DEBUG_ON
> >> where the default is to have slub debugging enabled in the build. Due to
> >> some code reorganization this behavior was dropped, but the code to make
> >> it work mostly stuck around. Restore the previous behavior by disabling
> >> the static key when we parse the commandline and see that we're trying
> >> to disable slub debugging.
> >>
> >> Cc: Vlastimil Babka <vbabka@suse.cz>
> >> Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks")
>
> Acked-by: Vlastimil Babka <vbabka@suse.cz>
>
> >
> > Is it caused by the commit ca0cab65ea2b ("mm, slub: introduce static
> > key for slub_debug()")?
>
> Yep, looks like a better Fixes: candidate.
>

Fixed it. Thanks.
Muchun Song May 27, 2021, 2:51 a.m. UTC | #4
On Thu, May 27, 2021 at 4:20 AM Stephen Boyd <swboyd@chromium.org> wrote:
>
> Quoting Vlastimil Babka (2021-05-26 03:39:54)
> > On 5/26/21 6:04 AM, Muchun Song wrote:
> > > On Wed, May 26, 2021 at 10:56 AM Stephen Boyd <swboyd@chromium.org> wrote:
> > >>
> > >> Passing slub_debug=- on the kernel commandline is supposed to disable
> > >> slub debugging. This is especially useful with CONFIG_SLUB_DEBUG_ON
> > >> where the default is to have slub debugging enabled in the build. Due to
> > >> some code reorganization this behavior was dropped, but the code to make
> > >> it work mostly stuck around. Restore the previous behavior by disabling
> > >> the static key when we parse the commandline and see that we're trying
> > >> to disable slub debugging.
> > >>
> > >> Cc: Vlastimil Babka <vbabka@suse.cz>
> > >> Fixes: e17f1dfba37b ("mm, slub: extend slub_debug syntax for multiple blocks")
> >
> > Acked-by: Vlastimil Babka <vbabka@suse.cz>
> >
> > >
> > > Is it caused by the commit ca0cab65ea2b ("mm, slub: introduce static
> > > key for slub_debug()")?
> >
> > Yep, looks like a better Fixes: candidate.
> >
>
> Fixed it. Thanks.

With that fix. Please feel free to add:

Reviewed-by: Muchun Song <songmuchun@bytedance.com>

Thanks.
diff mbox series

Patch

diff --git a/mm/slub.c b/mm/slub.c
index 438fa8d4c970..2f53e8a9c28e 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1396,6 +1396,8 @@  static int __init setup_slub_debug(char *str)
 out:
 	if (slub_debug != 0 || slub_debug_string)
 		static_branch_enable(&slub_debug_enabled);
+	else
+		static_branch_disable(&slub_debug_enabled);
 	if ((static_branch_unlikely(&init_on_alloc) ||
 	     static_branch_unlikely(&init_on_free)) &&
 	    (slub_debug & SLAB_POISON))