mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
	linux-mips@vger.kernel.org
Subject: Re: [PATCH v2] MIPS: mm: Use the bitmap API to allocate bitmaps
Date: Mon, 11 Jul 2022 10:37:54 +0200	[thread overview]
Message-ID: <20220711083754.GB6084@alpha.franken.de> (raw)
In-Reply-To: <4b64934fe14f1c2d30193df01e67a52022703b95.1656961396.git.christophe.jaillet@wanadoo.fr>

On Tue, Jul 05, 2022 at 10:56:51PM +0200, Christophe JAILLET wrote:
> Use bitmap_zalloc() instead of hand-writing them.
> 
> It is less verbose and it improves the semantic.
> 
> While at it, turn a bitmap_clear() into an equivalent bitmap_zero(). It is
> also less verbose.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> v1 --> v2: don't speak about bitmap_free() in the log message (Sergey Shtylyov)
> ---
>  arch/mips/mm/context.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/mips/mm/context.c b/arch/mips/mm/context.c
> index b25564090939..966f40066f03 100644
> --- a/arch/mips/mm/context.c
> +++ b/arch/mips/mm/context.c
> @@ -67,7 +67,7 @@ static void flush_context(void)
>  	int cpu;
>  
>  	/* Update the list of reserved MMIDs and the MMID bitmap */
> -	bitmap_clear(mmid_map, 0, num_mmids);
> +	bitmap_zero(mmid_map, num_mmids);
>  
>  	/* Reserve an MMID for kmap/wired entries */
>  	__set_bit(MMID_KERNEL_WIRED, mmid_map);
> @@ -277,8 +277,7 @@ static int mmid_init(void)
>  	WARN_ON(num_mmids <= num_possible_cpus());
>  
>  	atomic64_set(&mmid_version, asid_first_version(0));
> -	mmid_map = kcalloc(BITS_TO_LONGS(num_mmids), sizeof(*mmid_map),
> -			   GFP_KERNEL);
> +	mmid_map = bitmap_zalloc(num_mmids, GFP_KERNEL);
>  	if (!mmid_map)
>  		panic("Failed to allocate bitmap for %u MMIDs\n", num_mmids);
>  
> -- 
> 2.34.1

applied to mips-next.

Thomas.

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]

      reply	other threads:[~2022-07-11  8:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-05 20:56 Christophe JAILLET
2022-07-11  8:37 ` Thomas Bogendoerfer [this message]

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=20220711083754.GB6084@alpha.franken.de \
    --to=tsbogend@alpha.franken.de \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    /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

all inboxes | Powered by JetHome®