linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Dev Jain <dev.jain@arm.com>
To: Thorsten Blum <thorsten.blum@linux.dev>,
	Muchun Song <muchun.song@linux.dev>,
	Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/hugetlb: Use str_plural() in report_hugepages()
Date: Tue, 1 Jul 2025 09:22:38 +0530	[thread overview]
Message-ID: <b574a67a-3631-41c8-91b0-6cea92c01e49@arm.com> (raw)
In-Reply-To: <20250630171826.114008-2-thorsten.blum@linux.dev>


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>



  reply	other threads:[~2025-07-01  3:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-30 17:18 Thorsten Blum
2025-07-01  3:52 ` Dev Jain [this message]
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

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=b574a67a-3631-41c8-91b0-6cea92c01e49@arm.com \
    --to=dev.jain@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=muchun.song@linux.dev \
    --cc=osalvador@suse.de \
    --cc=thorsten.blum@linux.dev \
    /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