* [PATCH] tools/mm/slabinfo: Fix trace disabling logic
@ 2025-12-08 8:42 Kaushlendra Kumar
2025-12-08 9:29 ` Harry Yoo
0 siblings, 1 reply; 3+ messages in thread
From: Kaushlendra Kumar @ 2025-12-08 8:42 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Kaushlendra Kumar
When tracing is disabled (!tracing) but the slab has tracing enabled
(s->trace), the code should disable tracing by writing 0, not enable
it by writing 1. Fix the inverted logic to correctly turn off tracing.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
tools/mm/slabinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
index 80cdbd3db82d..7c51d283504d 100644
--- a/tools/mm/slabinfo.c
+++ b/tools/mm/slabinfo.c
@@ -798,7 +798,7 @@ static void slab_debug(struct slabinfo *s)
fprintf(stderr, "%s can only enable trace for one slab at a time\n", s->name);
}
if (!tracing && s->trace)
- set_obj(s, "trace", 1);
+ set_obj(s, "trace", 0);
}
static void totals(void)
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/mm/slabinfo: Fix trace disabling logic
2025-12-08 8:42 [PATCH] tools/mm/slabinfo: Fix trace disabling logic Kaushlendra Kumar
@ 2025-12-08 9:29 ` Harry Yoo
2025-12-08 12:25 ` Kumar, Kaushlendra
0 siblings, 1 reply; 3+ messages in thread
From: Harry Yoo @ 2025-12-08 9:29 UTC (permalink / raw)
To: Kaushlendra Kumar; +Cc: akpm, linux-mm, vbabka
On Mon, Dec 08, 2025 at 02:12:55PM +0530, Kaushlendra Kumar wrote:
> When tracing is disabled (!tracing) but the slab has tracing enabled
> (s->trace), the code should disable tracing by writing 0, not enable
> it by writing 1. Fix the inverted logic to correctly turn off tracing.
>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
> ---
After commit 060807f841ac9 ("mm, slub: make remaining slub_debug related
attributes read-only"), enabling or disabling debug option at runtime is
not supported anymore. slabinfo's -d and -dA flags are not supposed work on
recent kernels.
As it turns out enabling or disabling debug features at runtime is not a
good idea anyway, could you please working on dropping the feature instead?
> tools/mm/slabinfo.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
> index 80cdbd3db82d..7c51d283504d 100644
> --- a/tools/mm/slabinfo.c
> +++ b/tools/mm/slabinfo.c
> @@ -798,7 +798,7 @@ static void slab_debug(struct slabinfo *s)
> fprintf(stderr, "%s can only enable trace for one slab at a time\n", s->name);
> }
> if (!tracing && s->trace)
> - set_obj(s, "trace", 1);
> + set_obj(s, "trace", 0);
> }
>
> static void totals(void)
> --
> 2.34.1
--
Cheers,
Harry / Hyeonggon
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] tools/mm/slabinfo: Fix trace disabling logic
2025-12-08 9:29 ` Harry Yoo
@ 2025-12-08 12:25 ` Kumar, Kaushlendra
0 siblings, 0 replies; 3+ messages in thread
From: Kumar, Kaushlendra @ 2025-12-08 12:25 UTC (permalink / raw)
To: Harry Yoo; +Cc: akpm, linux-mm, vbabka
On Mon, Dec 08, 2025, Harry Hyeonggon Yoo wrote:
> On Mon, Dec 08, 2025 at 02:12:55PM +0530, Kaushlendra Kumar wrote:
>> When tracing is disabled (!tracing) but the slab has tracing enabled
>> (s->trace), the code should disable tracing by writing 0, not enable
>> it by writing 1. Fix the inverted logic to correctly turn off tracing.
>>
>> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
>> ---
>
> After commit 060807f841ac9 ("mm, slub: make remaining slub_debug related
> attributes read-only"), enabling or disabling debug option at runtime is
> not supported anymore. slabinfo's -d and -dA flags are not supposed work
> on recent kernels.
>
> As it turns out enabling or disabling debug features at runtime is not a
> good idea anyway, could you please working on dropping the feature instead?
Thanks for the context. You're right-fixing inverted logic in code
that's been non-functional since 060807f841ac9 doesn't add value.
I'll submit a cleanup series removing the obsolete
runtime debug functionality:
- Remove -d/-dA options and related usage text
- Drop slab_debug() and set_obj() for debug attributes
-Kaushlendra
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-08 12:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-08 8:42 [PATCH] tools/mm/slabinfo: Fix trace disabling logic Kaushlendra Kumar
2025-12-08 9:29 ` Harry Yoo
2025-12-08 12:25 ` Kumar, Kaushlendra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox