* [linux-lvm] [PATCH] calc_max_buckets bug
@ 2004-03-10 9:07 Chris Mason
2004-03-10 10:42 ` Joe Thornber
0 siblings, 1 reply; 4+ messages in thread
From: Chris Mason @ 2004-03-10 9:07 UTC (permalink / raw)
To: linux-lvm
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
Index: linux.24/drivers/md/lvm-snap.c
===================================================================
--- linux.24.orig/drivers/md/lvm-snap.c 2004-03-09 18:07:59.000000000 -0500
+++ linux.24/drivers/md/lvm-snap.c 2004-03-09 20:20:34.000000000 -0500
@@ -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;
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-lvm] [PATCH] calc_max_buckets bug
2004-03-10 9:07 [linux-lvm] [PATCH] calc_max_buckets bug Chris Mason
@ 2004-03-10 10:42 ` Joe Thornber
2004-03-10 13:13 ` Chris Mason
0 siblings, 1 reply; 4+ messages in thread
From: Joe Thornber @ 2004-03-10 10:42 UTC (permalink / raw)
To: linux-lvm
On Wed, Mar 10, 2004 at 09:10:59AM -0500, Chris Mason wrote:
> 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.
heh, this must be the only bit of code I copied from LVM1 :) Serves me
right for being lazy.
Thanks,
- Joe
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-lvm] [PATCH] calc_max_buckets bug
2004-03-10 10:42 ` Joe Thornber
@ 2004-03-10 13:13 ` Chris Mason
2004-03-11 4:14 ` Joe Thornber
0 siblings, 1 reply; 4+ messages in thread
From: Chris Mason @ 2004-03-10 13:13 UTC (permalink / raw)
To: linux-lvm
On Wed, 2004-03-10 at 10:44, Joe Thornber wrote:
> On Wed, Mar 10, 2004 at 09:10:59AM -0500, Chris Mason wrote:
> > 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.
>
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-lvm] [PATCH] calc_max_buckets bug
2004-03-10 13:13 ` Chris Mason
@ 2004-03-11 4:14 ` Joe Thornber
0 siblings, 0 replies; 4+ messages in thread
From: Joe Thornber @ 2004-03-11 4:14 UTC (permalink / raw)
To: linux-lvm
On Wed, Mar 10, 2004 at 01:17:27PM -0500, Chris Mason wrote:
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-03-11 9:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-10 9:07 [linux-lvm] [PATCH] calc_max_buckets bug Chris Mason
2004-03-10 10:42 ` Joe Thornber
2004-03-10 13:13 ` Chris Mason
2004-03-11 4:14 ` Joe Thornber
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox