]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
[PATCH] reduce size of bio mempools
authorBenjamin LaHaise <bcrl@kvack.org>
Thu, 23 Mar 2006 11:01:08 +0000 (03:01 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Thu, 23 Mar 2006 15:38:18 +0000 (07:38 -0800)
The biovec default mempool limit of 256 entries results in over 3MB of RAM
being permanently pinned, even on systems with only 128MB of RAM.  Since
mempool tries to allocate from the system pool first, it makes sense to
reduce the size of the mempool fallbacks to a more reasonable limit of 1-5
entries -- enough for the system to be able to make progress even under
load.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Acked-by: Jens Axboe <axboe@suse.de>
Cc: Matt Mackall <mpm@selenic.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/bio.c

index 1f3bb501c262bc9b94ad9e0b73c5af8acc511c90..8f1d2e815c96b696a630ba154ae9c438e3fa3fb2 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -1243,11 +1243,11 @@ static int __init init_bio(void)
                scale = 4;
 
        /*
-        * scale number of entries
+        * Limit number of entries reserved -- mempools are only used when
+        * the system is completely unable to allocate memory, so we only
+        * need enough to make progress.
         */
-       bvec_pool_entries = megabytes * 2;
-       if (bvec_pool_entries > 256)
-               bvec_pool_entries = 256;
+       bvec_pool_entries = 1 + scale;
 
        fs_bio_set = bioset_create(BIO_POOL_SIZE, bvec_pool_entries, scale);
        if (!fs_bio_set)