lkml.org 
[lkml]   [2021]   [Dec]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] arm64/mm: avoid fixmap race condition when create pud mapping
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

\
 
 \ /
  Last update: 2021-12-13 11:10    [W:0.064 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site