[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1f38c998-93e9-4dbb-abc8-401d8175dad4@kernel.org>
Date: Wed, 22 Nov 2023 00:39:05 +1000
From: Greg Ungerer <gerg@...nel.org>
To: Yury Norov <yury.norov@...il.com>, linux-kernel@...r.kernel.org,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-m68k@...ts.linux-m68k.org
Cc: Jan Kara <jack@...e.cz>,
Mirsad Todorovac <mirsad.todorovac@....unizg.hr>,
Matthew Wilcox <willy@...radead.org>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Maxim Kuvyrkov <maxim.kuvyrkov@...aro.org>,
Alexey Klimov <klimov.linux@...il.com>
Subject: Re: [PATCH 32/34] m68k: rework get_mmu_context()
Hi Yury,
On 19/11/23 01:51, Yury Norov wrote:
> ALSA code opencodes atomic find_and_set_bit_wrap(). Switch it to
^^^^
m68k?
> dedicated function.
>
> Signed-off-by: Yury Norov <yury.norov@...il.com>
Looks ok to me:
Acked-by: Greg Ungerer <gerg@...ux-m68k.org>
Regards
Greg
> ---
> arch/m68k/include/asm/mmu_context.h | 11 +++++------
> 1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/arch/m68k/include/asm/mmu_context.h b/arch/m68k/include/asm/mmu_context.h
> index 141bbdfad960..0419ad87a1c1 100644
> --- a/arch/m68k/include/asm/mmu_context.h
> +++ b/arch/m68k/include/asm/mmu_context.h
> @@ -35,12 +35,11 @@ static inline void get_mmu_context(struct mm_struct *mm)
> atomic_inc(&nr_free_contexts);
> steal_context();
> }
> - ctx = next_mmu_context;
> - while (test_and_set_bit(ctx, context_map)) {
> - ctx = find_next_zero_bit(context_map, LAST_CONTEXT+1, ctx);
> - if (ctx > LAST_CONTEXT)
> - ctx = 0;
> - }
> +
> + do {
> + ctx = find_and_set_bit_wrap(context_map, LAST_CONTEXT + 1, next_mmu_context);
> + } while (ctx > LAST_CONTEXT);
> +
> next_mmu_context = (ctx + 1) & LAST_CONTEXT;
> mm->context = ctx;
> context_mm[ctx] = mm;
Powered by blists - more mailing lists