[PATCH] base static allocations on physical memory size (1 of 7)
[email protected] (Dave Kleikamp) Fri, 18 Feb 2005 17:07:18 -0600 (CST)
| Newsgroups | gmane.comp.file-systems.jfs.patches |
|---|---|
| Message-ID | <[email protected]> |
# This is a BitKeeper generated diff -Nru style patch. # # ChangeSet # 2005/01/14 13:10:38-06:00 [email protected] # JFS: base static allocations on physical memory size # # On larger systems, performance is improved with a larger # allocation of tlocks & tblocks. Base the default size of these # allocations on the physical memory size. # # Signed-off-by: Dave Kleikamp <[email protected]> # diff -Nru a/fs/jfs/jfs_txnmgr.c b/fs/jfs/jfs_txnmgr.c --- a/fs/jfs/jfs_txnmgr.c 2005-02-18 17:01:53 -06:00 +++ b/fs/jfs/jfs_txnmgr.c 2005-02-18 17:01:53 -06:00 @@ -93,15 +93,15 @@ } TxStat; #endif -static int nTxBlock = 512; /* number of transaction blocks */ +static int nTxBlock = -1; /* number of transaction blocks */ module_param(nTxBlock, int, 0); MODULE_PARM_DESC(nTxBlock, - "Number of transaction blocks (default:512, max:65536)"); + "Number of transaction blocks (max:65536)"); -static int nTxLock = 4096; /* number of transaction locks */ +static int nTxLock = -1; /* number of transaction locks */ module_param(nTxLock, int, 0); MODULE_PARM_DESC(nTxLock, - "Number of transaction locks (default:4096, max:65536)"); + "Number of transaction locks (max:65536)"); struct tblock *TxBlock; /* transaction block table */ static int TxLockLWM; /* Low water mark for number of txLocks used */ @@ -249,6 +249,25 @@ int txInit(void) { int k, size; + struct sysinfo si; + + /* Set defaults for nTxLock and nTxBlock if unset */ + + if (nTxLock == -1) { + if (nTxBlock == -1) { + /* Base default on memory size */ + si_meminfo(&si); + if (si.totalram > (256 * 1024)) /* 1 GB */ + nTxLock = 64 * 1024; + else + nTxLock = si.totalram >> 2; + } else if (nTxBlock > (8 * 1024)) + nTxLock = 64 * 1024; + else + nTxLock = nTxBlock << 3; + } + if (nTxBlock == -1) + nTxBlock = nTxLock >> 3; /* Verify tunable parameters */ if (nTxBlock < 16) @@ -259,6 +278,9 @@ nTxLock = 256; /* No one should set it this low */ if (nTxLock > 65536) nTxLock = 65536; + + printk(KERN_INFO "JFS: nTxBlock = %d, nTxLock = %d\n", + nTxBlock, nTxLock); /* * initialize transaction block (tblock) table * @@ -266,8 +288,8 @@ * tid = 0 is reserved. */ TxLockLWM = (nTxLock * 4) / 10; - TxLockHWM = (nTxLock * 8) / 10; - TxLockVHWM = (nTxLock * 9) / 10; + TxLockHWM = (nTxLock * 7) / 10; + TxLockVHWM = (nTxLock * 8) / 10; size = sizeof(struct tblock) * nTxBlock; TxBlock = (struct tblock *) vmalloc(size);