tools/mm/slabinfo: Fix trace disabling logic
Subsystems (2)
PATCH 1/1 tools/mm/slabinfo: Fix trace disabling logic
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.
--- tools/mm/slabinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/mm/slabinfo.c +1 -1
@@ -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 )
Signature · 1 line
2.34.1
Quoted 6 lines · 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 <[email protected]>---
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?
Quoted 18 lines
tools/mm/slabinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tools/mm/slabinfo.c +1
-1@@ -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 )Signature · 1 line
2.34.1
Signature · 2 lines
Cheers, Harry / Hyeonggon
Quoted 8 lines · Harry Hyeonggon Yoo
Quoted 6 lines · 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 <[email protected]>---
Quoted 7 lines
After commit
060807f841ac9("mm, slub: make remainingslub_debugrelated 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