* [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
@ 2025-06-30 17:18 Thorsten Blum
2025-07-01 3:52 ` Dev Jain
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Thorsten Blum @ 2025-06-30 17:18 UTC (permalink / raw)
To: Muchun Song, Oscar Salvador, David Hildenbrand, Andrew Morton
Cc: Thorsten Blum, linux-mm, linux-kernel
Use the string choice helper function str_plural() to simplify the code
and to fix the following Coccinelle/coccicheck warning reported by
string_choices.cocci:
opportunity for str_plural(nrinvalid)
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
mm/hugetlb.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 9dc95eac558c..08abe7395f2f 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -25,6 +25,7 @@
#include <linux/mmdebug.h>
#include <linux/sched/signal.h>
#include <linux/rmap.h>
+#include <linux/string_choices.h>
#include <linux/string_helpers.h>
#include <linux/swap.h>
#include <linux/swapops.h>
@@ -3724,7 +3725,7 @@ static void __init report_hugepages(void)
buf, h->nr_huge_pages);
if (nrinvalid)
pr_info("HugeTLB: %s page size: %lu invalid page%s discarded\n",
- buf, nrinvalid, nrinvalid > 1 ? "s" : "");
+ buf, nrinvalid, str_plural(nrinvalid));
pr_info("HugeTLB: %d KiB vmemmap can be freed for a %s page\n",
hugetlb_vmemmap_optimizable_size(h) / SZ_1K, buf);
}
--
2.50.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
2025-06-30 17:18 [PATCH] mm/hugetlb: Use str_plural() in report_hugepages() Thorsten Blum
@ 2025-07-01 3:52 ` Dev Jain
2025-07-01 4:43 ` Anshuman Khandual
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Dev Jain @ 2025-07-01 3:52 UTC (permalink / raw)
To: Thorsten Blum, Muchun Song, Oscar Salvador, David Hildenbrand,
Andrew Morton
Cc: linux-mm, linux-kernel
On 30/06/25 10:48 pm, Thorsten Blum wrote:
> Use the string choice helper function str_plural() to simplify the code
> and to fix the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> opportunity for str_plural(nrinvalid)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> mm/hugetlb.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 9dc95eac558c..08abe7395f2f 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -25,6 +25,7 @@
> #include <linux/mmdebug.h>
> #include <linux/sched/signal.h>
> #include <linux/rmap.h>
> +#include <linux/string_choices.h>
> #include <linux/string_helpers.h>
> #include <linux/swap.h>
> #include <linux/swapops.h>
> @@ -3724,7 +3725,7 @@ static void __init report_hugepages(void)
> buf, h->nr_huge_pages);
> if (nrinvalid)
> pr_info("HugeTLB: %s page size: %lu invalid page%s discarded\n",
> - buf, nrinvalid, nrinvalid > 1 ? "s" : "");
> + buf, nrinvalid, str_plural(nrinvalid));
> pr_info("HugeTLB: %d KiB vmemmap can be freed for a %s page\n",
> hugetlb_vmemmap_optimizable_size(h) / SZ_1K, buf);
> }
LGTM
Reviewed-by: Dev Jain <dev.jain@arm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
2025-06-30 17:18 [PATCH] mm/hugetlb: Use str_plural() in report_hugepages() Thorsten Blum
2025-07-01 3:52 ` Dev Jain
@ 2025-07-01 4:43 ` Anshuman Khandual
2025-07-01 8:35 ` Thorsten Blum
2025-07-01 12:55 ` David Hildenbrand
2025-07-01 13:56 ` Oscar Salvador
3 siblings, 1 reply; 7+ messages in thread
From: Anshuman Khandual @ 2025-07-01 4:43 UTC (permalink / raw)
To: Thorsten Blum, Muchun Song, Oscar Salvador, David Hildenbrand,
Andrew Morton
Cc: linux-mm, linux-kernel
On 30/06/25 10:48 PM, Thorsten Blum wrote:
> Use the string choice helper function str_plural() to simplify the code
> and to fix the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> opportunity for str_plural(nrinvalid)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
> mm/hugetlb.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 9dc95eac558c..08abe7395f2f 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -25,6 +25,7 @@
> #include <linux/mmdebug.h>
> #include <linux/sched/signal.h>
> #include <linux/rmap.h>
> +#include <linux/string_choices.h>
> #include <linux/string_helpers.h>
> #include <linux/swap.h>
> #include <linux/swapops.h>
> @@ -3724,7 +3725,7 @@ static void __init report_hugepages(void)
> buf, h->nr_huge_pages);
> if (nrinvalid)
> pr_info("HugeTLB: %s page size: %lu invalid page%s discarded\n",
> - buf, nrinvalid, nrinvalid > 1 ? "s" : "");
> + buf, nrinvalid, str_plural(nrinvalid));
> pr_info("HugeTLB: %d KiB vmemmap can be freed for a %s page\n",
> hugetlb_vmemmap_optimizable_size(h) / SZ_1K, buf);
> }
Seems like there be more than one place where such str_plural() changes
could be made. Hence could you please collate them all part of a series
instead.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
2025-07-01 4:43 ` Anshuman Khandual
@ 2025-07-01 8:35 ` Thorsten Blum
2025-07-02 4:00 ` Anshuman Khandual
0 siblings, 1 reply; 7+ messages in thread
From: Thorsten Blum @ 2025-07-01 8:35 UTC (permalink / raw)
To: Anshuman Khandual
Cc: Muchun Song, Oscar Salvador, David Hildenbrand, Andrew Morton,
linux-mm, linux-kernel
On 1. Jul 2025, at 06:43, Anshuman Khandual wrote:
> Seems like there be more than one place where such str_plural() changes
> could be made. Hence could you please collate them all part of a series
> instead.
There are only two instances under mm/ and I didn't think a patch series
would be necessary.
Thanks,
Thorsten
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
2025-06-30 17:18 [PATCH] mm/hugetlb: Use str_plural() in report_hugepages() Thorsten Blum
2025-07-01 3:52 ` Dev Jain
2025-07-01 4:43 ` Anshuman Khandual
@ 2025-07-01 12:55 ` David Hildenbrand
2025-07-01 13:56 ` Oscar Salvador
3 siblings, 0 replies; 7+ messages in thread
From: David Hildenbrand @ 2025-07-01 12:55 UTC (permalink / raw)
To: Thorsten Blum, Muchun Song, Oscar Salvador, Andrew Morton
Cc: linux-mm, linux-kernel
On 30.06.25 19:18, Thorsten Blum wrote:
> Use the string choice helper function str_plural() to simplify the code
> and to fix the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> opportunity for str_plural(nrinvalid)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
2025-06-30 17:18 [PATCH] mm/hugetlb: Use str_plural() in report_hugepages() Thorsten Blum
` (2 preceding siblings ...)
2025-07-01 12:55 ` David Hildenbrand
@ 2025-07-01 13:56 ` Oscar Salvador
3 siblings, 0 replies; 7+ messages in thread
From: Oscar Salvador @ 2025-07-01 13:56 UTC (permalink / raw)
To: Thorsten Blum
Cc: Muchun Song, David Hildenbrand, Andrew Morton, linux-mm, linux-kernel
On Mon, Jun 30, 2025 at 07:18:26PM +0200, Thorsten Blum wrote:
> Use the string choice helper function str_plural() to simplify the code
> and to fix the following Coccinelle/coccicheck warning reported by
> string_choices.cocci:
>
> opportunity for str_plural(nrinvalid)
>
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Acked-by: Oscar Salvador <osalvador@suse.de>
--
Oscar Salvador
SUSE Labs
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
2025-07-01 8:35 ` Thorsten Blum
@ 2025-07-02 4:00 ` Anshuman Khandual
0 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2025-07-02 4:00 UTC (permalink / raw)
To: Thorsten Blum
Cc: Muchun Song, Oscar Salvador, David Hildenbrand, Andrew Morton,
linux-mm, linux-kernel
On 01/07/25 2:05 PM, Thorsten Blum wrote:
> On 1. Jul 2025, at 06:43, Anshuman Khandual wrote:
>> Seems like there be more than one place where such str_plural() changes
>> could be made. Hence could you please collate them all part of a series
>> instead.
>
> There are only two instances under mm/ and I didn't think a patch series
> would be necessary.
Reasonable enough.
LGTM.
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-02 4:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-30 17:18 [PATCH] mm/hugetlb: Use str_plural() in report_hugepages() Thorsten Blum
2025-07-01 3:52 ` Dev Jain
2025-07-01 4:43 ` Anshuman Khandual
2025-07-01 8:35 ` Thorsten Blum
2025-07-02 4:00 ` Anshuman Khandual
2025-07-01 12:55 ` David Hildenbrand
2025-07-01 13:56 ` Oscar Salvador
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox