* [PATCH] tools/mm/slabinfo: recognize --partial/-p option
@ 2025-12-08 9:10 Kaushlendra Kumar
2025-12-08 9:45 ` Harry Yoo
0 siblings, 1 reply; 3+ messages in thread
From: Kaushlendra Kumar @ 2025-12-08 9:10 UTC (permalink / raw)
To: akpm; +Cc: linux-mm, Kaushlendra Kumar
The long option "partial" maps to 'p' but the short options string
and switch handled 'P', causing -p/--partial to be rejected as invalid.
Use lowercase 'p' consistently in the getopt short string and the switch
to enable sorting by partial slabs.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
tools/mm/slabinfo.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
index 7c51d283504d..7f239da26ed2 100644
--- a/tools/mm/slabinfo.c
+++ b/tools/mm/slabinfo.c
@@ -125,7 +125,7 @@ static void usage(void)
"-n|--numa Show NUMA information\n"
"-N|--lines=K Show the first K slabs\n"
"-o|--ops Show kmem_cache_ops\n"
- "-P|--partial Sort by number of partial slabs\n"
+ "-p|--partial Sort by number of partial slabs\n"
"-r|--report Detailed report on single slabs\n"
"-s|--shrink Shrink slabs\n"
"-S|--Size Sort by size\n"
@@ -1427,7 +1427,7 @@ int main(int argc, char *argv[])
page_size = getpagesize();
- while ((c = getopt_long(argc, argv, "aABd::DefhilLnN:oPrsStTUvXz1",
+ while ((c = getopt_long(argc, argv, "aABd::DefhilLnN:oprsStTUvXz1",
opts, NULL)) != -1)
switch (c) {
case 'a':
@@ -1481,7 +1481,7 @@ int main(int argc, char *argv[])
case 'r':
show_report = 1;
break;
- case 'P':
+ case 'p':
sort_partial = 1;
break;
case 's':
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/mm/slabinfo: recognize --partial/-p option
2025-12-08 9:10 [PATCH] tools/mm/slabinfo: recognize --partial/-p option Kaushlendra Kumar
@ 2025-12-08 9:45 ` Harry Yoo
2025-12-08 10:43 ` Kumar, Kaushlendra
0 siblings, 1 reply; 3+ messages in thread
From: Harry Yoo @ 2025-12-08 9:45 UTC (permalink / raw)
To: Kaushlendra Kumar; +Cc: akpm, linux-mm, vbabka
On Mon, Dec 08, 2025 at 02:40:18PM +0530, Kaushlendra Kumar wrote:
> The long option "partial" maps to 'p' but the short options string
> and switch handled 'P', causing -p/--partial to be rejected as invalid.
> Use lowercase 'p' consistently in the getopt short string and the switch
> to enable sorting by partial slabs.
>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
> ---
I think breaking an existing option -P is not a good idea.
Can we make --Partial work instead of breaking -P option?
> tools/mm/slabinfo.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c
> index 7c51d283504d..7f239da26ed2 100644
> --- a/tools/mm/slabinfo.c
> +++ b/tools/mm/slabinfo.c
> @@ -125,7 +125,7 @@ static void usage(void)
> "-n|--numa Show NUMA information\n"
> "-N|--lines=K Show the first K slabs\n"
> "-o|--ops Show kmem_cache_ops\n"
> - "-P|--partial Sort by number of partial slabs\n"
> + "-p|--partial Sort by number of partial slabs\n"
> "-r|--report Detailed report on single slabs\n"
> "-s|--shrink Shrink slabs\n"
> "-S|--Size Sort by size\n"
> @@ -1427,7 +1427,7 @@ int main(int argc, char *argv[])
>
> page_size = getpagesize();
>
> - while ((c = getopt_long(argc, argv, "aABd::DefhilLnN:oPrsStTUvXz1",
> + while ((c = getopt_long(argc, argv, "aABd::DefhilLnN:oprsStTUvXz1",
> opts, NULL)) != -1)
> switch (c) {
> case 'a':
> @@ -1481,7 +1481,7 @@ int main(int argc, char *argv[])
> case 'r':
> show_report = 1;
> break;
> - case 'P':
> + case 'p':
> sort_partial = 1;
> break;
> case 's':
> --
> 2.34.1
>
>
--
Cheers,
Harry / Hyeonggon
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH] tools/mm/slabinfo: recognize --partial/-p option
2025-12-08 9:45 ` Harry Yoo
@ 2025-12-08 10:43 ` Kumar, Kaushlendra
0 siblings, 0 replies; 3+ messages in thread
From: Kumar, Kaushlendra @ 2025-12-08 10:43 UTC (permalink / raw)
To: Harry Yoo; +Cc: akpm, linux-mm, vbabka
-----Original Message-----
From: Harry Yoo <harry.yoo@oracle.com>
Sent: Monday, December 8, 2025 3:16 PM
To: Kumar, Kaushlendra <kaushlendra.kumar@intel.com>
Cc: akpm@linux-foundation.org; linux-mm@kvack.org; vbabka@suse.cz
Subject: Re: [PATCH] tools/mm/slabinfo: recognize --partial/-p option
On Mon, Dec 08, 2025 at 02:40:18PM +0530, Kaushlendra Kumar wrote:
> The long option "partial" maps to 'p' but the short options string and
> switch handled 'P', causing -p/--partial to be rejected as invalid.
> Use lowercase 'p' consistently in the getopt short string and the
> switch to enable sorting by partial slabs.
>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
> ---
I think breaking an existing option -P is not a good idea.
Can we make --Partial work instead of breaking -P option?
> tools/mm/slabinfo.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/mm/slabinfo.c b/tools/mm/slabinfo.c index
> 7c51d283504d..7f239da26ed2 100644
> --- a/tools/mm/slabinfo.c
> +++ b/tools/mm/slabinfo.c
> @@ -125,7 +125,7 @@ static void usage(void)
> "-n|--numa Show NUMA information\n"
> "-N|--lines=K Show the first K slabs\n"
> "-o|--ops Show kmem_cache_ops\n"
> - "-P|--partial Sort by number of partial slabs\n"
> + "-p|--partial Sort by number of partial slabs\n"
> "-r|--report Detailed report on single slabs\n"
> "-s|--shrink Shrink slabs\n"
> "-S|--Size Sort by size\n"
> @@ -1427,7 +1427,7 @@ int main(int argc, char *argv[])
>
> page_size = getpagesize();
>
> - while ((c = getopt_long(argc, argv, "aABd::DefhilLnN:oPrsStTUvXz1",
> + while ((c = getopt_long(argc, argv, "aABd::DefhilLnN:oprsStTUvXz1",
> opts, NULL)) != -1)
> switch (c) {
> case 'a':
> @@ -1481,7 +1481,7 @@ int main(int argc, char *argv[])
> case 'r':
> show_report = 1;
> break;
> - case 'P':
> + case 'p': On Mon, Dec 08, 2025, Harry Hyeonggon Yoo wrote:
> On Mon, Dec 08, 2025 at 02:40:18PM +0530, Kaushlendra Kumar wrote:
>> The long option "partial" maps to 'p' but the short options string and
>> switch handled 'P', causing -p/--partial to be rejected as invalid.
>> Use lowercase 'p' consistently in the getopt short string and the
>> switch to enable sorting by partial slabs.
>>
>> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
>> ---
>
> I think breaking an existing option -P is not a good idea.
> Can we make --Partial work instead of breaking -P option?
Thanks for catching this. You're right-changing -P to -p would break
existing scripts relying on the uppercase flag.
I'll respin the patch to keep -P working.
Will send v2 shortly.
-Kaushlendra
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-08 10:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-08 9:10 [PATCH] tools/mm/slabinfo: recognize --partial/-p option Kaushlendra Kumar
2025-12-08 9:45 ` Harry Yoo
2025-12-08 10:43 ` Kumar, Kaushlendra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox