tmpfs: Make tmpfs scalable with caches for free blocks
Subsystems (2)
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
@@ -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 512struct 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