Skip to contentSkip to conversation

tmpfs: Make tmpfs scalable with caches for free blocks

PATCH Superseded Tim Chen 1 participant 1 message May 26, 2010

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Tim Chen

author
#0 lore raw

PATCH v2 2/2 tmpfs: Make tmpfs scalable with caches for free blocks

The current implementation of tmpfs is not scalable. The stat_lock is contended whenever we need to get a new page, leading to lots lock contentions. This patch makes use of the qtoken library to maintain local caches of free pages to speed up getting and returning of pages without acquisition of stat_lock improve the performance of tmpfs.

 include/linux/shmem_fs.h |    4 ++-
 mm/shmem.c               |   58 +++++++++++++++++++++++++--------------------
 2 files changed, 35 insertions(+), 27 deletions(-)
include/linux/shmem_fs.h +3 -1
index e164291..6ba014d 100644
@@ -3,10 +3,12 @@
 
 #include <linux/swap.h>
 #include <linux/mempolicy.h>
+#include <linux/qtoken.h>
 
 /* inode in-kernel data */
 
 #define SHMEM_NR_DIRECT 16
+#define SHMEM_FREE_BLK_CACHE_SZ 512
 
 struct shmem_inode_info {
 	spinlock_t		lock;
@@ -23,7 +25,7 @@ struct shmem_inode_info {
 
 struct shmem_sb_info {
 	unsigned long max_blocks;   /* How many blocks are allowed */
-	unsigned long free_blocks;  /* How many are left for allocation */
+	struct qtoken token_jar;    /* Token jar of free blocks */
 	unsigned long max_inodes;   /* How many inodes are allowed */
 	unsigned long free_inodes;  /* How many are left for allocation */
 	spinlock_t stat_lock;	    /* Serialize shmem_sb_info changes */
mm/shmem.c +32 -26

134 lines not on this page · raw message