Re: [PATCH] mm: vmalloc: Use the vmap_area_lock to protect ne_fit_preload_node

From: Uladzislau Rezki
Date: Fri Oct 04 2019 - 13:04:24 EST


>
> You could have been migrated to another CPU while
> memory has been allocated.
>
That is true that we can migrate since we allow preemption
when allocate. But it does not really matter on which CPU an
allocation occurs and whether we migrate or not.

If we land on another CPU or still stay on the same, we will
check anyway one more time if it(another/same CPU) is preloaded
or not:

<snip>
preempt_disable();
if (__this_cpu_cmpxchg(ne_fit_preload_node, NULL, pva)
<snip>

if another, we can free the object allocated on previous step if
it already has it. If another CPU does not have it, save it in
ne_fit_preload_node for another current CPU to reuse later. Further
we can not migrate because of:

<snip>
spin_lock(&vmap_area_lock);
preempt_enable();
<snip>

--
Vlad Rezki