[Top] [All Lists]

[PATCH] Give logbufs a better default

To: linux-xfs@xxxxxxxxxxx
Subject: [PATCH] Give logbufs a better default
From: Andi Kleen <ak@xxxxxxx>
Date: Wed, 11 Jun 2003 11:35:25 +0200
Sender: linux-xfs-bounce@xxxxxxxxxxx
A long standing problem in XFS is that in the default configuration
metadata performance is not that great because it uses not enough
log buffers. There are FAQs around to fix this, but it would be better
if the kernel did the right thing by default.

The main problem is probably that XFS still uses the default from the
early 90ies, which are probably not that good anymore for today's machines.

This patch changes the logbufs= default based on the available memory.
If you have 128MB or less it uses 3 logbufs (normally 96K per file system) 
For 400MB or less it uses 5 (160K) 
For anything bigger 8 (256K) 

It is still a kind of bandaid. I think the better solution would be to 
dynamically allocate new log buffers as needed until some limit
(and block if the memory cannot be allocated). This should not be that
bad because vmalloc/vfree are not that expensive anymore and with some
luck you can even get a physically continuous buffer (e.g. on a 16byte page size
ia64 system) 

Patch for XFS 1.3pre1.


--- linux/fs/xfs/xfs_log.c-o    2003-06-10 14:27:57.000000000 +0200
+++ linux/fs/xfs/xfs_log.c      2003-06-11 11:29:55.000000000 +0200
@@ -1072,9 +1072,15 @@
                 * This is the normal path.  If m_logbufs == -1, then the
                 * admin has chosen to use the system defaults for logbuffers.
-               if (mp->m_logbufs == -1)
-                       log->l_iclog_bufs = XLOG_NUM_ICLOGS;
-               else
+               if (mp->m_logbufs == -1) { 
+                       if (xfs_physmem <= btoc(128*1024*1024)) { 
+                               log->l_iclog_bufs = 3; 
+                       } else if (xfs_physmem <= btoc(400*1024*1024)) { 
+                               log->l_iclog_bufs = 5; 
+                       } else {
+                               log->l_iclog_bufs = 8; /* 256K with 32K bufs */
+                       }
+               } else
                        log->l_iclog_bufs = mp->m_logbufs;
 #if defined(DEBUG) || defined(XLOG_NOLOG)

<Prev in Thread] Current Thread [Next in Thread>