mm: zram: amend SLAB_RECLAIM_ACCOUNT on zspage_cachep
Subsystems (2)
PATCH 1/1 mm: zram: amend SLAB_RECLAIM_ACCOUNT on zspage_cachep
From: Zhaoyang Huang <[email protected]>
Zspage_cachep is found be merged with other kmem cache during test, which is not good for debug things(zs_pool->zspage_cachep present to be another kmem cache in memory dumpfile). It is also neccessary to do so as shrinker has been registered for zspage. Amending this flag can help kernel to calculate SLAB_RECLAIMBLE correctly.
--- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/zsmalloc.c +1 -1
@@ -328,7 +328,7 @@ static int create_cache(struct zs_pool *pool)return 1 ; pool->zspage_cachep =kmem_cache_create ("zspage" ,sizeof (struct zspage ), -0 ,0 ,NULL ); +0 ,SLAB_RECLAIM_ACCOUNT ,NULL );if (!pool->zspage_cachep) {kmem_cache_destroy (pool->handle_cachep); pool->handle_cachep =NULL ;
Signature · 1 line
1.9.1
Minchan Kim
maintainerQuoted 5 lines · Huangzhaoyang
From: Zhaoyang Huang <[email protected]>
Zspage_cachepis found be merged with other kmem cache during test, which is not good for debugthings(zs_pool->zspage_cachep present to be another kmem cache in memory dumpfile). It is also neccessary to do so as shrinker has
It's not a only problem of zsmalloc because slab want to minimize fragmentation so try to merge several objects if it's allowed. So I don't think it's particular problem of zsmalloc.
I guess slub has some option maybe "nomerge" if you want it.
Quoted 13 lines
been registered for zspage. Amending this flag can help kernel to calculate
SLAB_RECLAIMBLEcorrectly.Signed-off-by Zhaoyang Huang <[email protected]>--- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/zsmalloc.c +0
-0
mm/zsmalloc.c static int create_cache(struct zs_pool *pool) · line 331
Quoted 5 lines
mm/zsmalloc.c +1
-1@@ -328,7 +328,7 @@ static int create_cache(struct zs_pool *pool)return 1 ; pool->zspage_cachep =kmem_cache_create ("zspage" ,sizeof (struct zspage ), -0 ,0 ,NULL ); +0 ,SLAB_RECLAIM_ACCOUNT ,NULL );
How does zspage become SLAB_RECLAIM_ACCOUNT?
I took the flag as "cacheable" object. IOW, when the shrinker ask to reclaim the object, it should reclaim(e.g., discarding) those objects for reclaming. However, that's not the case in zsmalloc.
Quoted 35 lines · Minchan Kim
Quoted 5 lines · Huangzhaoyang
From: Zhaoyang Huang <[email protected]>
Zspage_cachepis found be merged with other kmem cache during test, which is not good for debugthings(zs_pool->zspage_cachep present to be another kmem cache in memory dumpfile). It is also neccessary to do so as shrinker hasIt's not a only problem of zsmalloc because slab want to minimize fragmentation so try to merge several objects if it's allowed. So I don't think it's particular problem of zsmalloc.
I guess slub has some option maybe "nomerge" if you want it.Quoted 13 lines
been registered for zspage. Amending this flag can help kernel to calculate
SLAB_RECLAIMBLEcorrectly.Signed-off-by Zhaoyang Huang <[email protected]>--- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/zsmalloc.c +0
-0mm/zsmalloc.c static int create_cache(struct zs_pool *pool) · line 331
Quoted 5 lines
mm/zsmalloc.c +1
-1@@ -328,7 +328,7 @@ static int create_cache(struct zs_pool *pool)return 1 ; pool->zspage_cachep =kmem_cache_create ("zspage" ,sizeof (struct zspage ), -0 ,0 ,NULL ); +0 ,SLAB_RECLAIM_ACCOUNT ,NULL );How does zspage become
SLAB_RECLAIM_ACCOUNT?
Quoted 4 lines
I took the flag as "cacheable" object. IOW, when the shrinker ask to reclaim the object, it should
reclaim(e.g., discarding)those objects for reclaming. However, that's not the case in zsmalloc.
alloc_slab will take the allocated object into account as SLAB_RECLAIMABLE when this flag set on the kmem_cache
Minchan Kim
maintainerQuoted 36 lines · Zhaoyang Huang
Quoted 35 lines · Minchan Kim
Quoted 5 lines · Huangzhaoyang
From: Zhaoyang Huang <[email protected]>
Zspage_cachepis found be merged with other kmem cache during test, which is not good for debugthings(zs_pool->zspage_cachep present to be another kmem cache in memory dumpfile). It is also neccessary to do so as shrinker hasIt's not a only problem of zsmalloc because slab want to minimize fragmentation so try to merge several objects if it's allowed. So I don't think it's particular problem of zsmalloc.
I guess slub has some option maybe "nomerge" if you want it.Quoted 13 lines
been registered for zspage. Amending this flag can help kernel to calculate
SLAB_RECLAIMBLEcorrectly.Signed-off-by Zhaoyang Huang <[email protected]>--- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/zsmalloc.c +0
-0mm/zsmalloc.c static int create_cache(struct zs_pool *pool) · line 331
Quoted 5 lines
mm/zsmalloc.c +1
-1@@ -328,7 +328,7 @@ static int create_cache(struct zs_pool *pool)return 1 ; pool->zspage_cachep =kmem_cache_create ("zspage" ,sizeof (struct zspage ), -0 ,0 ,NULL ); +0 ,SLAB_RECLAIM_ACCOUNT ,NULL );How does zspage become
SLAB_RECLAIM_ACCOUNT?
Quoted 6 lines
Quoted 4 lines
I took the flag as "cacheable" object. IOW, when the shrinker ask to reclaim the object, it should
reclaim(e.g., discarding)those objects for reclaming. However, that's not the case in zsmalloc.
alloc_slabwill take the allocated object into account asSLAB_RECLAIMABLEwhen this flag set on thekmem_cache
My point is zspage_cachep is not an reclimable slab cache. Please describe why you believe it's reclaimable slab.
Quoted 42 lines · Minchan Kim
Quoted 40 lines · Zhaoyang Huang
Quoted 39 lines · Minchan Kim
Quoted 5 lines · Huangzhaoyang
From: Zhaoyang Huang <[email protected]>
Zspage_cachepis found be merged with other kmem cache during test, which is not good for debugthings(zs_pool->zspage_cachep present to be another kmem cache in memory dumpfile). It is also neccessary to do so as shrinker hasIt's not a only problem of zsmalloc because slab want to minimize fragmentation so try to merge several objects if it's allowed. So I don't think it's particular problem of zsmalloc.
I guess slub has some option maybe "nomerge" if you want it.Quoted 13 lines
been registered for zspage. Amending this flag can help kernel to calculate
SLAB_RECLAIMBLEcorrectly.Signed-off-by Zhaoyang Huang <[email protected]>--- mm/zsmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/zsmalloc.c +0
-0mm/zsmalloc.c static int create_cache(struct zs_pool *pool) · line 331
Quoted 5 lines
mm/zsmalloc.c +1
-1@@ -328,7 +328,7 @@ static int create_cache(struct zs_pool *pool)return 1 ; pool->zspage_cachep =kmem_cache_create ("zspage" ,sizeof (struct zspage ), -0 ,0 ,NULL ); +0 ,SLAB_RECLAIM_ACCOUNT ,NULL );How does zspage become
SLAB_RECLAIM_ACCOUNT?I took the flag as "cacheable" object. IOW, when the shrinker ask to reclaim the object, it should
reclaim(e.g., discarding)those objects for reclaming. However, that's not the case in zsmalloc.
Quoted 5 lines
Quoted 2 lines
alloc_slabwill take the allocated object into account asSLAB_RECLAIMABLEwhen this flag set on thekmem_cacheMy point is
zspage_cachepis not an reclimable slab cache. Please describe why you believe it's reclaimable slab.
zspage registered slab shrinker via zs_register_shrinker, in which the zspage be freed to cache