]> git.karo-electronics.de Git - karo-tx-linux.git/commit
dm raid1: switch read_record from kmalloc to slab to save memory
authorMikulas Patocka <mpatocka@redhat.com>
Fri, 3 Apr 2009 17:45:23 +0000 (17:45 +0000)
committerChris Wright <chrisw@sous-sol.org>
Mon, 27 Apr 2009 17:36:56 +0000 (10:36 -0700)
commit6858778b9cf9436f667a101ffc62c20f889ea294
tree0e45e5b572443d9650f6d0cb2e5949eecf053e8b
parent187ab6618c3afae07d5ca0727966ea461e5d07a7
dm raid1: switch read_record from kmalloc to slab to save memory

upstream commit: 95f8fac8dc6139fedfb87746e0c8fda9b803cb46

With my previous patch to save bi_io_vec, the size of dm_raid1_read_record
is significantly increased (the vector list takes 3072 bytes on 32-bit machines
and 4096 bytes on 64-bit machines).

The structure dm_raid1_read_record used to be allocated with kmalloc,
but kmalloc aligns the size on the next power-of-two so an object
slightly greater than 4096 will allocate 8192 bytes of memory and half of
that memory will be wasted.

This patch turns kmalloc into a slab cache which doesn't have this
padding so it will reduce the memory consumed.

Cc: stable@kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
drivers/md/dm-raid1.c