linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vijayanand Jitta <vjitta@codeaurora.org>
To: David Rientjes <rientjes@google.com>
Cc: cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com,
	akpm@linux-foundation.org, vbabka@suse.cz, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, vinmenon@codeaurora.org
Subject: Re: [PATCH] mm: slub: Fix slub_debug disablement for list of slabs
Date: Tue, 20 Jul 2021 12:05:32 +0530	[thread overview]
Message-ID: <d34f793d-7c7e-aec4-a1a3-eab233dc11ab@codeaurora.org> (raw)
In-Reply-To: <dfcaaf6b-9a23-41f8-7baf-187e7c83e20@google.com>



On 7/19/2021 11:51 AM, David Rientjes wrote:
> On Tue, 13 Jul 2021, vjitta@codeaurora.org wrote:
> 
>> From: Vijayanand Jitta <vjitta@codeaurora.org>
>>
>> Consider the scenario where CONFIG_SLUB_DEBUG_ON is set
>> and we would want to disable slub_debug for few slabs.
>> Using boot parameter with slub_debug=-,slab_name syntax
>> doesn't work as expected i.e; only disabling debugging for
>> the specified list of slabs, instead it disables debugging
>> for all slabs. Fix this.
>>
>> Signed-off-by: Vijayanand Jitta <vjitta@codeaurora.org>
>> ---
>>  mm/slub.c | 6 ++++--
>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/slub.c b/mm/slub.c
>> index dc863c1..5a88418 100644
>> --- a/mm/slub.c
>> +++ b/mm/slub.c
>> @@ -1429,6 +1429,7 @@ static int __init setup_slub_debug(char *str)
>>  	char *slab_list;
>>  	bool global_slub_debug_changed = false;
>>  	bool slab_list_specified = false;
>> +	bool slab_list_debug_disable = true;
>>  
>>  	slub_debug = DEBUG_DEFAULT_FLAGS;
>>  	if (*str++ != '=' || !*str)
>> @@ -1436,7 +1437,6 @@ static int __init setup_slub_debug(char *str)
>>  		 * No options specified. Switch on full debugging.
>>  		 */
>>  		goto out;
>> -
>>  	saved_str = str;
>>  	while (str) {
>>  		str = parse_slub_debug_flags(str, &flags, &slab_list, true);
>> @@ -1445,6 +1445,8 @@ static int __init setup_slub_debug(char *str)
>>  			slub_debug = flags;
>>  			global_slub_debug_changed = true;
>>  		} else {
>> +			if (flags || !IS_ENABLED(CONFIG_SLUB_DEBUG_ON))
> 
> Could you explain the check for CONFIG_SLUB_DEBUG_ON here?
>
Thanks for the review.

The check for CONFIG_SLUB_DEBUG_ON is for below scenario:

Consider CONFIG_SLUB_DEBUG_ON is not set and the below boot parameter is
set incorrectly "slub_debug=-,slab_name", Now without the additional
CONFIG_SLUB_DEBUG_ON check slab_list_debug_disable will still be true
and slub_debug will be set to DEBUG_DEFAULT_FLAGS instead of 0 as the
below check fails.

if (!global_slub_debug_changed && !slab_list_debug_disable)
	slub_debug = 0;

> I don't believe that using `-' for slub_debug is *only* useful when 
> CONFIG_SLUB_DEBUG_ON is enabled.
> 

'-' is still useful in CONFIG_SLUB_DEBUG_ON disabled case even with the
above check, all the possible cases using '-' work as expected.

i.e;
slub_debug=-.slab_name
slub_debug=flag,slab_name;-,slab_name

Thanks,
Vijay

>> +				slab_list_debug_disable = false;
>>  			slab_list_specified = true;
>>  		}
>>  	}
>> @@ -1456,7 +1458,7 @@ static int __init setup_slub_debug(char *str)
>>  	 * long as there is no option specifying flags without a slab list.
>>  	 */
>>  	if (slab_list_specified) {
>> -		if (!global_slub_debug_changed)
>> +		if (!global_slub_debug_changed && !slab_list_debug_disable)
>>  			slub_debug = 0;
>>  		slub_debug_string = saved_str;
>>  	}

-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a
member of Code Aurora Forum, hosted by The Linux Foundation

  reply	other threads:[~2021-07-20  6:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-13 11:45 [PATCH] mm: slub: Fix slub_debug disablement for list of slabs vjitta
2021-07-19  6:21 ` David Rientjes
2021-07-20  6:35   ` Vijayanand Jitta [this message]
2021-07-26 22:32 ` Vlastimil Babka
2021-07-27  4:43   ` Vijayanand Jitta
2021-07-27 12:22     ` Vlastimil Babka
2021-08-02  3:26       ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d34f793d-7c7e-aec4-a1a3-eab233dc11ab@codeaurora.org \
    --to=vjitta@codeaurora.org \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=vbabka@suse.cz \
    --cc=vinmenon@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).