[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 22/44] xen/xmalloc: return an emptied region after dropping the pool lock



On Wed, Nov 18, 2026 at 12:05 PM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 03.11.2026 23:13, George Dunlap wrote:
> > When a free leaves a whole region of an xmalloc pool empty,
> > xmem_pool_free() hands the region back through pool->put_mem() with
> > pool->lock still held.  For the xenheap pool that is
> > free_xenheap_pages(), which takes the heap lock inside the pool lock
> > and runs arch_xenheap_pages_free().  On x86 with a sparse directmap
> > view configured, the latter takes the page out of the sparse view,
> > at the cost of one to three rounds of TLB-flush IPIs to every CPU,
> > while every other CPU's sub-page xmalloc() and xfree() waits on the
> > pool lock.
> >
> > By then the region is on no free list and no longer counted in the
> > pool,
>
> This, I think, isn't entirely accurate, as pool->num_regions still
> accounts for the region (and pool->used_size still accounts for the
> bhdr). Yet at the same time the change you make also better mirrors
> the ->get_mem() side, where accounting is done only after the call.

Ack

> > Assisted-by: Claude Code:claude-opus-5-5
> > Signed-off-by: George Dunlap <gwd@xxxxxxxxxxxxxx>
>
> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>

Thanks,
 -George



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.