Skip to contentSkip to conversation

fs: amend SLAB_RECLAIM_ACCOUNT on gfs2 related slab cache

PATCH In review Huangzhaoyang 3 participants 3 messages Jan 5, 2021 GFS2 file system

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 fs: amend SLAB_RECLAIM_ACCOUNT on gfs2 related slab cache

From: Zhaoyang Huang <[email protected]>

As gfs2_quotad_cachep and gfs2_glock_cachep have registered the shrinker, amending SLAB_RECLAIM_ACCOUNT when creating them, which make the slab acount to be presiced.

---
v2: add gfs2_glock_cachep for same operation
---

---
 fs/gfs2/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
fs/gfs2/main.c +2 -2
index 136484e..23144a7 100644
@@ -100,7 +100,7 @@ static int __init init_gfs2_fs(void)
 	error = -ENOMEM;
 	gfs2_glock_cachep = kmem_cache_create("gfs2_glock",
 					      sizeof(struct gfs2_glock),
-					      0, 0,
+					      0, SLAB_RECLAIM_ACCOUNT,
 					      gfs2_init_glock_once);
 	if (!gfs2_glock_cachep)
 		goto fail_cachep1;
@@ -136,7 +136,7 @@ static int __init init_gfs2_fs(void)
 
 	gfs2_quotad_cachep = kmem_cache_create("gfs2_quotad",
 					       sizeof(struct gfs2_quota_data),
-					       0, 0, NULL);
+					       0, SLAB_RECLAIM_ACCOUNT, NULL);
 	if (!gfs2_quotad_cachep)
 		goto fail_cachep6;
 
Signature · 1 line
1.9.1
#1 lore raw

----- Original Message -----

Quoted 10 lines

From: Zhaoyang Huang <[email protected]>

As gfs2_quotad_cachep and gfs2_glock_cachep have registered the shrinker, amending SLAB_RECLAIM_ACCOUNT when creating them, which make the slab acount to be presiced.

---
v2: add gfs2_glock_cachep for same operation
---

Hi,

Thanks. Your patch is now pushed to the linux-gfs2/for-next branch. I cleaned up the description a bit. For example, I changed "fs:" to "gfs2:" to conform to other gfs2 patches.

Regards,

Bob Peterson

#2 lore raw

Bob,

Am Di., 5. Jan. 2021 um 14:28 Uhr schrieb Bob Peterson <[email protected]>:

Quoted 11 lines

----- Original Message -----

Quoted 10 lines

From: Zhaoyang Huang <[email protected]>

As gfs2_quotad_cachep and gfs2_glock_cachep have registered the shrinker, amending SLAB_RECLAIM_ACCOUNT when creating them, which make the slab acount to be presiced.

---
v2: add gfs2_glock_cachep for same operation
---

Quoted 5 lines

Hi,

Thanks. Your patch is now pushed to the linux-gfs2/for-next branch. I cleaned up the description a bit. For example, I changed "fs:" to "gfs2:" to conform to other gfs2 patches.

so the patch description now reads:

"As gfs2_quotad_cachep and gfs2_glock_cachep have registered shrinkers, amending SLAB_RECLAIM_ACCOUNT when creating them, which improves slab accounting."

I'm not sure what that description is based on; the definition of SLAB_RECLAIM_ACCOUNT in include/linux/slab.h looks as follows, which indicates that the purpose isn't really accounting but object grouping:

/* The following flags affect the page allocator grouping pages by mobility */ /* Objects are reclaimable */
#define SLAB_RECLAIM_ACCOUNT ((slab_flags_t __force)0x00020000U)
#define SLAB_TEMPORARY SLAB_RECLAIM_ACCOUNT /* Objects are
short-lived */

Furthermore, would it make sense to use SLAB_RECLAIM_ACCOUNT or SLAB_TEMPORARY for gfs2_bufdata and gfs2_trans as well?

Thanks,
Andreas