[POC 09/12] fs/inode.c: access inode_cachep via rai_load
From: Rasmus Villemoes
Date: Wed Oct 17 2018 - 18:34:20 EST
This avoids a cacheline access to get the value of the inode_cachep
pointer in the places that do a kmem_cache_*(inode_cachep, ...);
Signed-off-by: Rasmus Villemoes <linux@xxxxxxxxxxxxxxxxxx>
---
fs/inode.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/fs/inode.c b/fs/inode.c
index 42f6d25f32a5..f1e9f548494e 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -19,6 +19,7 @@
#include <linux/ratelimit.h>
#include <linux/list_lru.h>
#include <linux/iversion.h>
+#include <linux/rai.h>
#include <trace/events/writeback.h>
#include "internal.h"
@@ -74,7 +75,8 @@ struct inodes_stat_t inodes_stat;
static DEFINE_PER_CPU(unsigned long, nr_inodes);
static DEFINE_PER_CPU(unsigned long, nr_unused);
-static struct kmem_cache *inode_cachep __read_mostly;
+static struct kmem_cache *__inode_cachep __read_mostly;
+#define inode_cachep rai_load(__inode_cachep)
static long get_nr_inodes(void)
{
@@ -1951,7 +1953,7 @@ void __init inode_init_early(void)
void __init inode_init(void)
{
/* inode slab cache */
- inode_cachep = kmem_cache_create("inode_cache",
+ __inode_cachep = kmem_cache_create("inode_cache",
sizeof(struct inode),
0,
(SLAB_RECLAIM_ACCOUNT|SLAB_PANIC|
--
2.19.1.6.gbde171bbf5