Whamcloud - gitweb
LU-12313 llite: Mark lustre_inode_cache as reclaimable 90/35790/4
authorJacek Tomaka <jacek.tomaka@poczta.fm>
Sat, 18 May 2019 02:17:30 +0000 (10:17 +0800)
committerOleg Drokin <green@whamcloud.com>
Wed, 21 Aug 2019 05:03:50 +0000 (05:03 +0000)
This is required for proper kernel memory available accounting.
Without it memory allocated to lustre_inode_cache appears as
SUnreclaim where in reality it should apper as SReclaimable.
This affect MemAvailable as well (it is lower than it should be).

Signed-off-by: Jacek Tomaka <jacek.tomaka@poczta.fm>
Change-Id: Iac526a62d0e063b82eea451d1fafa42f2bb4d3b8
Reviewed-on: https://review.whamcloud.com/35790
Tested-by: jenkins <devops@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Neil Brown <neilb@suse.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/super25.c

index 82fa1f2..bf3a131 100644 (file)
@@ -87,6 +87,7 @@ static int __init lustre_init(void)
 {
        struct lnet_process_id lnet_id;
        int i, rc;
 {
        struct lnet_process_id lnet_id;
        int i, rc;
+       unsigned long lustre_inode_cache_flags;
 
        CLASSERT(sizeof(LUSTRE_VOLATILE_HDR) == LUSTRE_VOLATILE_HDR_LEN + 1);
 
 
        CLASSERT(sizeof(LUSTRE_VOLATILE_HDR) == LUSTRE_VOLATILE_HDR_LEN + 1);
 
@@ -96,9 +97,15 @@ static int __init lustre_init(void)
        CDEBUG(D_INFO, "Lustre client module (%p).\n",
               &lustre_super_operations);
 
        CDEBUG(D_INFO, "Lustre client module (%p).\n",
               &lustre_super_operations);
 
+       lustre_inode_cache_flags = SLAB_HWCACHE_ALIGN | SLAB_RECLAIM_ACCOUNT |
+                                  SLAB_MEM_SPREAD;
+#ifdef SLAB_ACCOUNT
+       lustre_inode_cache_flags |= SLAB_ACCOUNT;
+#endif
+
        ll_inode_cachep = kmem_cache_create("lustre_inode_cache",
                                            sizeof(struct ll_inode_info),
        ll_inode_cachep = kmem_cache_create("lustre_inode_cache",
                                            sizeof(struct ll_inode_info),
-                                           0, SLAB_HWCACHE_ALIGN, NULL);
+                                           0, lustre_inode_cache_flags, NULL);
        if (ll_inode_cachep == NULL)
                GOTO(out_cache, rc = -ENOMEM);
 
        if (ll_inode_cachep == NULL)
                GOTO(out_cache, rc = -ENOMEM);