mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
scsi: sym53c8xx_2: Replace __get_free_pages() with kmalloc()
sym53c8xx_2 driver has an internal memory allocator for small allocations of the driver structures. The backing memory for that allocator is allocated with __get_free_pages(). This memory 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@redhat.com Reviewed-by: Hannes Reinecke <hare@kernel.org> Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Link: https://patch.msgid.link/20260704-b4-scsi-v2-4-7d2d21a810de@kernel.org Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
parent
0abe3fb1c5
commit
e64b8f3224
|
|
@ -1110,9 +1110,9 @@ sym_build_sge(struct sym_hcb *np, struct sym_tblmove *data, u64 badd, int len)
|
|||
*/
|
||||
|
||||
#define sym_get_mem_cluster() \
|
||||
(void *) __get_free_pages(GFP_ATOMIC, SYM_MEM_PAGE_ORDER)
|
||||
kmalloc(PAGE_SIZE << SYM_MEM_PAGE_ORDER, GFP_ATOMIC)
|
||||
#define sym_free_mem_cluster(p) \
|
||||
free_pages((unsigned long)p, SYM_MEM_PAGE_ORDER)
|
||||
kfree(p)
|
||||
|
||||
/*
|
||||
* Link between free memory chunks of a given size.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user