Allocate gfs2_rgrpd from slab memory
PATCH 1/1 Allocate gfs2_rgrpd from slab memory
Hi,
This patch moves the gfs2_rgrpd structure to its own slab memory. This makes it easier to control and monitor, and yields less memory fragmentation.
Regards,
Bob Peterson
Red Hat GFS
Signed-off-by Bob Peterson <[email protected]>
--
fs/gfs2/main.c | 10 ++++++++++ fs/gfs2/rgrp.c | 4 ++-- fs/gfs2/util.c | 1 + fs/gfs2/util.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-)
fs/gfs2/main.c +10 -0
@@ -89,6 +89,12 @@ static int __init init_gfs2_fs(void)if (!gfs2_bufdata_cachep) goto fail; + gfs2_rgrpd_cachep =kmem_cache_create ("gfs2_rgrpd" , +sizeof (struct gfs2_rgrpd ), +0 ,0 ,NULL ); +if (!gfs2_rgrpd_cachep) + goto fail; + error =register_filesystem (&gfs2_fs_type);if (error) goto fail;
@@ -108,6 +114,9 @@ fail_unregister: fail:gfs2_glock_exit (); +if (gfs2_rgrpd_cachep) +kmem_cache_destroy (gfs2_rgrpd_cachep); +if (gfs2_bufdata_cachep)kmem_cache_destroy (gfs2_bufdata_cachep);
@@ -133,6 +142,7 @@ static void __exit exit_gfs2_fs(void)unregister_filesystem (&gfs2_fs_type);unregister_filesystem (&gfs2meta_fs_type); +kmem_cache_destroy (gfs2_rgrpd_cachep);kmem_cache_destroy (gfs2_bufdata_cachep);kmem_cache_destroy (gfs2_inode_cachep);kmem_cache_destroy (gfs2_glock_cachep);
fs/gfs2/rgrp.c +2 -2
@@ -353,7 +353,7 @@ static void clear_rgrpdi(struct gfs2_sbd *sdp) }kfree (rgd->rd_bits); -kfree (rgd); +kmem_cache_free (gfs2_rgrpd_cachep, rgd); } }
@@ -516,7 +516,7 @@ static int read_rindex_entry(struct gfs2_inode *ip,return error; } - rgd =kzalloc (sizeof (struct gfs2_rgrpd ),GFP_NOFS ); + rgd =kmem_cache_zalloc (gfs2_rgrpd_cachep,GFP_NOFS ); error = -ENOMEM ;if (!rgd)return error;
fs/gfs2/util.c +1 -0
@@ -25,6 +25,7 @@struct kmem_cache *gfs2_glock_cachep__read_mostly ;struct kmem_cache *gfs2_inode_cachep__read_mostly ;struct kmem_cache *gfs2_bufdata_cachep__read_mostly ; +struct kmem_cache *gfs2_rgrpd_cachep__read_mostly ;void gfs2_assert_i (struct gfs2_sbd *sdp) {
fs/gfs2/util.h +1 -0
@@ -147,6 +147,7 @@ gfs2_io_error_bh_i((sdp), (bh), __FUNCTION__, __FILE__, __LINE__);extern struct kmem_cache *gfs2_glock_cachep;extern struct kmem_cache *gfs2_inode_cachep;extern struct kmem_cache *gfs2_bufdata_cachep; +extern struct kmem_cache *gfs2_rgrpd_cachep;static inline unsigned int gfs2_tune_get_i (struct gfs2_tune *gt,unsigned int *p)
PATCH 1/1 Allocate gfs2_rgrpd from slab memory
Hi,
Now in the -nmw git tree. Thanks,
Steve.
Quoted 102 lines · Bob Peterson
Hi,
This patch moves the
gfs2_rgrpdstructure to its own slab memory. This makes it easier to control and monitor, and yields less memory fragmentation.Regards,
Bob Peterson
Red Hat GFSSigned-off-by Bob Peterson <[email protected]>--
fs/gfs2/main.c | 10 ++++++++++ fs/gfs2/rgrp.c | 4 ++-- fs/gfs2/util.c | 1 + fs/gfs2/util.h | 1 + 4 files changed, 14 insertions(+), 2 deletions(-)fs/gfs2/main.c +10
-0@@ -89,6 +89,12 @@ static int __init init_gfs2_fs(void)if (!gfs2_bufdata_cachep) goto fail; + gfs2_rgrpd_cachep =kmem_cache_create ("gfs2_rgrpd" , +sizeof (struct gfs2_rgrpd ), +0 ,0 ,NULL ); +if (!gfs2_rgrpd_cachep) + goto fail; + error =register_filesystem (&gfs2_fs_type);if (error) goto fail;@@ -108,6 +114,9 @@ fail_unregister: fail:gfs2_glock_exit (); +if (gfs2_rgrpd_cachep) +kmem_cache_destroy (gfs2_rgrpd_cachep); +if (gfs2_bufdata_cachep)kmem_cache_destroy (gfs2_bufdata_cachep);@@ -133,6 +142,7 @@ static void __exit exit_gfs2_fs(void)unregister_filesystem (&gfs2_fs_type);unregister_filesystem (&gfs2meta_fs_type); +kmem_cache_destroy (gfs2_rgrpd_cachep);kmem_cache_destroy (gfs2_bufdata_cachep);kmem_cache_destroy (gfs2_inode_cachep);kmem_cache_destroy (gfs2_glock_cachep);fs/gfs2/rgrp.c +2
-2@@ -353,7 +353,7 @@ static void clear_rgrpdi(struct gfs2_sbd *sdp) }kfree (rgd->rd_bits); -kfree (rgd); +kmem_cache_free (gfs2_rgrpd_cachep, rgd); } }@@ -516,7 +516,7 @@ static int read_rindex_entry(struct gfs2_inode *ip,return error; } - rgd =kzalloc (sizeof (struct gfs2_rgrpd ),GFP_NOFS ); + rgd =kmem_cache_zalloc (gfs2_rgrpd_cachep,GFP_NOFS ); error = -ENOMEM ;if (!rgd)return error;fs/gfs2/util.c +1
-0@@ -25,6 +25,7 @@struct kmem_cache *gfs2_glock_cachep__read_mostly ;struct kmem_cache *gfs2_inode_cachep__read_mostly ;struct kmem_cache *gfs2_bufdata_cachep__read_mostly ; +struct kmem_cache *gfs2_rgrpd_cachep__read_mostly ;void gfs2_assert_i (struct gfs2_sbd *sdp) {fs/gfs2/util.h +1
-0@@ -147,6 +147,7 @@ gfs2_io_error_bh_i((sdp), (bh), __FUNCTION__, __FILE__, __LINE__);extern struct kmem_cache *gfs2_glock_cachep;extern struct kmem_cache *gfs2_inode_cachep;extern struct kmem_cache *gfs2_bufdata_cachep; +extern struct kmem_cache *gfs2_rgrpd_cachep;static inline unsigned int gfs2_tune_get_i (struct gfs2_tune *gt,unsigned int *p)