calc_max_buckets bug
PATCH 1/1 calc_max_buckets bug
Hello everyone,
This is in both 2.4.x lvm and 2.6.x dm code, calc_max_buckets is broken for 32bit machines with > 4GB of ram. This leads to -ENOMEM errors during snapshot creation.
The patch below just changes things to allocate 2MB worth of hash buckets all the time. Has anyone done benchmarking into how much cpu time snapshots spend on hash table lookups?
-chris
drivers/md/lvm-snap.c +2 -6
@@ -504,13 +504,9 @@ out:static int calc_max_buckets (void ) { -unsigned long mem; - - mem = num_physpages <<PAGE_SHIFT ; - mem /=100 ; - mem *=2 ; +/* use a fixed size of 2MB */ +unsigned long mem =2 *1024 *1024 ; mem /=sizeof (struct list_head ); -return mem; }
Quoted 5 lines · Chris Mason
Hello everyone,
This is in both 2.4.x lvm and 2.6.x dm code,
calc_max_bucketsis broken for 32bit machines with > 4GB of ram. This leads to-ENOMEMerrors during snapshot creation.
heh, this must be the only bit of code I copied from LVM1 :) Serves me right for being lazy.
Thanks,
- Joe
Quoted 9 lines · Joe Thornber
Quoted 5 lines · Chris Mason
Hello everyone,
This is in both 2.4.x lvm and 2.6.x dm code,
calc_max_bucketsis broken for 32bit machines with > 4GB of ram. This leads to-ENOMEMerrors during snapshot creation.heh, this must be the only bit of code I copied from LVM1 :) Serves me right for being lazy.
Do you see any problems with using a smaller fixed size on the hash table. It seems like 2MB should be enough to me.
-chris
Quoted 2 lines · Chris Mason
Do you see any problems with using a smaller fixed size on the hash table. It seems like 2MB should be enough to me.
I've done no experiments in this area.
- Joe