ChangeSet 1.2231.1.12, 2005/03/28 19:19:32-08:00, [EMAIL PROTECTED]

        [PATCH] slab shrinkers: use vfs_cache_pressure
        
        Fix some bugs spotted by Andrea Arcangeli <[EMAIL PROTECTED]>
        
        - When we added /proc/sys/vm/vfs_cache_pressure we forgot to allow it to
          tune the dquot and mbcache slabs as well.
        
        - Reduce lock contention in shrink_dqcache_memory().
        
        - Use dqstats.free_dquots in shrink_dqcache_memory(): this is the count 
of
          reclaimable objects.
        
        - Export sysctl_vfs_cache_pressure to GPL modules for mbcache.o
        
        Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
        Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>



 dcache.c  |    1 +
 dquot.c   |   12 +++++-------
 mbcache.c |    2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)


diff -Nru a/fs/dcache.c b/fs/dcache.c
--- a/fs/dcache.c       2005-03-28 21:09:02 -08:00
+++ b/fs/dcache.c       2005-03-28 21:09:02 -08:00
@@ -36,6 +36,7 @@
 /* #define DCACHE_DEBUG 1 */
 
 int sysctl_vfs_cache_pressure = 100;
+EXPORT_SYMBOL_GPL(sysctl_vfs_cache_pressure);
 
  __cacheline_aligned_in_smp DEFINE_SPINLOCK(dcache_lock);
 seqlock_t rename_lock __cacheline_aligned_in_smp = SEQLOCK_UNLOCKED;
diff -Nru a/fs/dquot.c b/fs/dquot.c
--- a/fs/dquot.c        2005-03-28 21:09:02 -08:00
+++ b/fs/dquot.c        2005-03-28 21:09:02 -08:00
@@ -505,14 +505,12 @@
 
 static int shrink_dqcache_memory(int nr, unsigned int gfp_mask)
 {
-       int ret;
-
-       spin_lock(&dq_list_lock);
-       if (nr)
+       if (nr) {
+               spin_lock(&dq_list_lock);
                prune_dqcache(nr);
-       ret = dqstats.allocated_dquots;
-       spin_unlock(&dq_list_lock);
-       return ret;
+               spin_unlock(&dq_list_lock);
+       }
+       return (dqstats.free_dquots / 100) * sysctl_vfs_cache_pressure;
 }
 
 /*
diff -Nru a/fs/mbcache.c b/fs/mbcache.c
--- a/fs/mbcache.c      2005-03-28 21:09:02 -08:00
+++ b/fs/mbcache.c      2005-03-28 21:09:02 -08:00
@@ -225,7 +225,7 @@
                                                   e_lru_list), gfp_mask);
        }
 out:
-       return count;
+       return (count / 100) * sysctl_vfs_cache_pressure;
 }
 
 
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to