Re: [PATCH 1/7] mm: introduce simple_malloc()/simple_free()

From: Eric Dumazet
Date: Sun Nov 16 2008 - 01:10:00 EST


Arjan van de Ven a écrit :
On Sun, 16 Nov 2008 13:35:03 +0800
Lai Jiangshan <laijs@xxxxxxxxxxxxxx> wrote:

vmalloc() is not good for performance and increasing fragment.
but vmalloc() is need for some subsystems' alternative malloc,
like cgroup's tasks file and other subsystems(about 20 subsystems).

actually what you are pointing out is that these areas need improvement
to not need such huge blocks of memory... but only a series of smaller
blocks instead.



Just zap vmalloc()/vfree() then ?

More seriously, vmalloc()/vfree() were designed partly to make people life easier,
not to be *the* premium interface to manage kernel memory

Some parts of the kernel cannot afford the cost of vmalloc()/vfree(), so people
must think and design complex algos.

I personnaly like this cleanup too. For example bnx2 driver actually uses vmalloc() while
a kmalloc() should be OK for bnx2_alloc_rx_mem()

# grep bnx2 /proc/vmallocinfo
0xf8260000-0xf8274000 81920 bnx2_init_board+0x104/0xae0 phys=f6000000 ioremap
0xf8280000-0xf8294000 81920 bnx2_init_board+0x104/0xae0 phys=fa000000 ioremap
0xf82c1000-0xf82c3000 8192 bnx2_alloc_rx_mem+0x33/0x310 pages=1 vmalloc
0xf82d9000-0xf82db000 8192 bnx2_alloc_rx_mem+0x33/0x310 pages=1 vmalloc

I have two comments :

1) Names should be not "simple" : That is misleading. "convenient" maybe, or "slow"...

2) Since vmalloc()/vfree() is potentially a very expensive operation, we should make
slow_malloc()/slow_free() or whatever name is chosen, uninlined. No need to try to save
3 or 4 cpu cycles. This will save icache at least.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/