[PATCH v2] arm64/mm: avoid fixmap race condition when create pud mapping
Catalin Marinas
catalin.marinas at arm.com
Mon Dec 13 01:57:08 PST 2021
On Mon, Dec 13, 2021 at 08:37:04AM +0100, David Hildenbrand wrote:
> On 13.12.21 08:27, Jianyong Wu wrote:
> >>> @@ -359,6 +365,7 @@ static void alloc_init_pud(pgd_t *pgdp, unsigned long addr, unsigned long end,
> >>> } while (pudp++, addr = next, addr != end);
> >>>
> >>> pud_clear_fixmap();
> >>> + spin_unlock(&fixmap_lock);
> >>> }
> >>>
> >>> static void __create_pgd_mapping(pgd_t *pgdir, phys_addr_t phys,
> >>>
> >>
> >> As the race could only happen with memory hotplug being enabled, could
> >> not we wrap this around with CONFIG_MEMORY_HOTPLUG, just to narrow
> >> its scope possibly speed up other non-hotplug cases ?
Assuming you can quantify the speed-up...
> > I think it's better.
>
> We better avoid using ifdef if not really necessary, it just uglifies
> the code. We could add
>
> if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG))
> ...
>
> But should we really try to micto-optimize this code and make it harder
> to read for the purpose of an unproven performance gain? (if there is no
> contention, we'll most probably not even recognize that we're taking a lock)
I agree, I don't see the point of this optimisation.
--
Catalin
More information about the linux-arm-kernel
mailing list