On 10.11.26 08:14, Mike Rapoport (Microsoft) wrote:
set_evtchn_to_irq() allocates a page for the event channel to IRQ
number software lookup table and xen_init_IRQ() allocates the PIRQ EOI
bitmap that is registered with the hypervisor in PV domains.

These buffers can be allocated with kmalloc() as there's nothing special
about them to go directly to the page allocator. The PIRQ EOI bitmap is
passed to the hypervisor by its frame number and must occupy a whole
page, which is guaranteed for a PAGE_SIZE kmalloc() allocation as it is
naturally aligned.

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(), __get_free_page() with
__GFP_ZERO with kzalloc() and free_page[s]() with kfree().

Link: 
https://lore.kernel.org/all/[email protected]
Signed-off-by: Mike Rapoport (Microsoft) <[email protected]>
Reviewed-by: Juergen Gross <[email protected]>


Juergen

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to