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

Re: [PATCH] xen/events: replace __get_free_pages() with kmalloc()



On Mon, Nov 09, 2026 at 08:53:18AM +0100, Juergen Gross wrote:
> On 08.11.26 09:42, Mike Rapoport (Microsoft) wrote:
> > set_evtchn_to_irq() allocates a page for the event channel to IRQ
> > number software lookup table.
> > 
> > This buffer can be allocated with kmalloc() as there's nothing special
> > about it to go directly to the page allocator.
> > 
> > kmalloc() provides a better API that does not require ugly casts and
> > kfree() does not need to know the size of the freed object.
> > 
> > Performance difference between kmalloc() and __get_free_pages() is not
> > measurable as both allocators take an object/page from a per-CPU list for
> > fast path allocations.
> > 
> > For the slow path the performance is anyway determined by the amount of
> > reclaim involved rather than by what allocator is used.
> > 
> > Replace use of __get_free_pages() with kmalloc() and free_pages() with
> > kfree().
> > 
> > Link: 
> > https://lore.kernel.org/all/635405e4-9423-4a25-a6e7-e03c8ea0bcbe@xxxxxxxxxx
> > Signed-off-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
> 
> Shouldn't you also replace __get_free_page() in xen_init_IRQ()? I don't see
> why this is being omitted.

Just an overlook, will send v2 with this too. 
 
> Juergen

-- 
Sincerely yours,
Mike.



 


Rackspace

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