f2fs: fix wrong memory footprint statistics in debugfs
PATCH 1/1 f2fs: fix wrong memory footprint statistics in debugfs
Our value of memory footprint statistics showed in debugfs is not calculated correctly. Fix it in this patch.
--- fs/f2fs/debug.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
fs/f2fs/debug.c +10 -5
@@ -125,7 +125,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi)int i;if (si->base_mem) - goto get_cache; + goto get_dynamic_cache; si->base_mem =sizeof (struct f2fs_sb_info ) + sbi->sb->s_blocksize; si->base_mem +=2 *sizeof (struct f2fs_inode_info );
@@ -161,13 +161,18 @@ static void update_mem_info(struct f2fs_sb_info *sbi) si->base_mem +=sizeof (struct f2fs_nm_info ); si->base_mem +=__bitmap_size (sbi,NAT_BITMAP ); +get_dynamic_cache:/* build gc */ - si->base_mem +=sizeof (struct f2fs_gc_kthread ); +if (sbi->gc_thread) + si->base_mem +=sizeof (struct f2fs_gc_kthread ); + +/* build merge flush thread */ +if (SM_I (sbi)->cmd_control_info) + si->base_mem +=sizeof (struct flush_cmd_control ); -get_cache:/* free nids */ - si->cache_mem =NM_I (sbi)->fcnt; - si->cache_mem +=NM_I (sbi)->nat_cnt; + si->cache_mem =NM_I (sbi)->fcnt *sizeof (struct free_nid ); + si->cache_mem +=NM_I (sbi)->nat_cnt *sizeof (struct nat_entry ); npages =NODE_MAPPING (sbi)->nrpages; si->cache_mem += npages <<PAGE_CACHE_SHIFT ; npages =META_MAPPING (sbi)->nrpages;
Signature · 1 line
2.2.1
Jaegeuk Kim
maintainerHi Chao,
Quoted 24 lines · Chao Yu
Our value of memory footprint statistics showed in debugfs is not calculated correctly. Fix it in this patch.
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/debug.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)fs/f2fs/debug.c +1
-1@@ -125,7 +125,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi)int i;if (si->base_mem) - goto get_cache; + goto get_dynamic_cache; si->base_mem =sizeof (struct f2fs_sb_info ) + sbi->sb->s_blocksize; si->base_mem +=2 *sizeof (struct f2fs_inode_info );@@ -161,13 +161,18 @@ static void update_mem_info(struct f2fs_sb_info *sbi) si->base_mem +=sizeof (struct f2fs_nm_info ); si->base_mem +=__bitmap_size (sbi,NAT_BITMAP );
fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 171
Quoted 10 lines
fs/f2fs/debug.c +7
-1+get_dynamic_cache:/* build gc */ - si->base_mem +=sizeof (struct f2fs_gc_kthread ); +if (sbi->gc_thread) + si->base_mem +=sizeof (struct f2fs_gc_kthread ); + +/* build merge flush thread */ +if (SM_I (sbi)->cmd_control_info) + si->base_mem +=sizeof (struct flush_cmd_control );
It seems base_mem increases repeatedly?
fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 175
Quoted 7 lines
fs/f2fs/debug.c +2
-3-get_cache:/* free nids */ - si->cache_mem =NM_I (sbi)->fcnt; - si->cache_mem +=NM_I (sbi)->nat_cnt; + si->cache_mem =NM_I (sbi)->fcnt *sizeof (struct free_nid ); + si->cache_mem +=NM_I (sbi)->nat_cnt *sizeof (struct nat_entry );
Oh, nice catch.
Quoted 5 lines
fs/f2fs/debug.c +0
-0npages =NODE_MAPPING (sbi)->nrpages; si->cache_mem += npages <<PAGE_CACHE_SHIFT ; npages =META_MAPPING (sbi)->nrpages;Signature · 1 line
2.2.1
Hi Jaegeuk,
Quoted 35 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:49 AM
To: Chao Yu
Cc: Changman Lee; [email protected]; [email protected]
Subject: Re: [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfsHi Chao,
Quoted 25 lines · Chao Yu
Our value of memory footprint statistics showed in debugfs is not calculated correctly. Fix it in this patch.
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/debug.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)fs/f2fs/debug.c +1
-1@@ -125,7 +125,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi)int i;if (si->base_mem) - goto get_cache; + goto get_dynamic_cache; si->base_mem =sizeof (struct f2fs_sb_info ) + sbi->sb->s_blocksize; si->base_mem +=2 *sizeof (struct f2fs_inode_info );@@ -161,13 +161,18 @@ static void update_mem_info(struct f2fs_sb_info *sbi) si->base_mem +=sizeof (struct f2fs_nm_info ); si->base_mem +=__bitmap_size (sbi,NAT_BITMAP );
Quoted 11 lines
fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi) · line 171
Quoted 9 lines
fs/f2fs/debug.c +7
-1+get_dynamic_cache:/* build gc */ - si->base_mem +=sizeof (struct f2fs_gc_kthread ); +if (sbi->gc_thread) + si->base_mem +=sizeof (struct f2fs_gc_kthread ); + +/* build merge flush thread */ +if (SM_I (sbi)->cmd_control_info) + si->base_mem +=sizeof (struct flush_cmd_control );It seems
base_memincreases repeatedly?
Right, my mistaken. How about counting memory of these two cache into cache_mem as following?
Quoted 1 line
From
edfa0beaed83ebfec34b07bfcb5e8ce3cdcb0858Mon Sep 17 00:00:00 2001
From: Chao Yu <[email protected]>
Date: Sat, 10 Jan 2015 19:24:24 +0800
Subject: [PATCH] f2fs: fix wrong memory footprint statistics in debugfs
Our value of memory footprint statistics showed in debugfs is not calculated correctly. Fix it in this patch.
--- fs/f2fs/debug.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
fs/f2fs/debug.c +11 -4
@@ -163,13 +163,20 @@ static void update_mem_info(struct f2fs_sb_info *sbi) si->base_mem +=sizeof (struct f2fs_nm_info ); si->base_mem +=__bitmap_size (sbi,NAT_BITMAP ); +get_cache: + si->cache_mem =0 ; +/* build gc */ - si->base_mem +=sizeof (struct f2fs_gc_kthread ); +if (sbi->gc_thread) + si->cache_mem +=sizeof (struct f2fs_gc_kthread ); + +/* build merge flush thread */ +if (SM_I (sbi)->cmd_control_info) + si->cache_mem +=sizeof (struct flush_cmd_control ); -get_cache:/* free nids */ - si->cache_mem =NM_I (sbi)->fcnt; - si->cache_mem +=NM_I (sbi)->nat_cnt; + si->cache_mem +=NM_I (sbi)->fcnt *sizeof (struct free_nid ); + si->cache_mem +=NM_I (sbi)->nat_cnt *sizeof (struct nat_entry ); npages =NODE_MAPPING (sbi)->nrpages; si->cache_mem += npages <<PAGE_CACHE_SHIFT ; npages =META_MAPPING (sbi)->nrpages;
Signature · 1 line
2.2.1
Jaegeuk Kim
maintainerQuoted 49 lines · Chao Yu
Hi Jaegeuk,
Quoted 35 lines
-----Original Message-----
From: Jaegeuk Kim [mailto:[email protected]]
Sent: Wednesday, January 07, 2015 3:49 AM
To: Chao Yu
Cc: Changman Lee; [email protected]; [email protected]
Subject: Re: [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfsHi Chao,
Quoted 25 lines · Chao Yu
Our value of memory footprint statistics showed in debugfs is not calculated correctly. Fix it in this patch.
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/debug.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)fs/f2fs/debug.c +1
-1@@ -125,7 +125,7 @@ static void update_mem_info(struct f2fs_sb_info *sbi)int i;if (si->base_mem) - goto get_cache; + goto get_dynamic_cache; si->base_mem =sizeof (struct f2fs_sb_info ) + sbi->sb->s_blocksize; si->base_mem +=2 *sizeof (struct f2fs_inode_info );@@ -161,13 +161,18 @@ static void update_mem_info(struct f2fs_sb_info *sbi) si->base_mem +=sizeof (struct f2fs_nm_info ); si->base_mem +=__bitmap_size (sbi,NAT_BITMAP );Quoted 11 lines
fs/f2fs/debug.c static void update_mem_info(struct f2fs_sb_info *sbi)
Quoted 9 lines
fs/f2fs/debug.c +7
-1+get_dynamic_cache:/* build gc */ - si->base_mem +=sizeof (struct f2fs_gc_kthread ); +if (sbi->gc_thread) + si->base_mem +=sizeof (struct f2fs_gc_kthread ); + +/* build merge flush thread */ +if (SM_I (sbi)->cmd_control_info) + si->base_mem +=sizeof (struct flush_cmd_control );It seems
base_memincreases repeatedly?
Quoted 2 lines
Right, my mistaken. How about counting memory of these two cache into
cache_memas following?
Looks good to me. :)
Thanks,
Quoted 45 lines
Quoted 2 lines
From
edfa0beaed83ebfec34b07bfcb5e8ce3cdcb0858Mon Sep 17 00:00:00 2001From: Chao Yu <[email protected]>
Date: Sat, 10 Jan 2015 19:24:24 +0800
Subject: [PATCH] f2fs: fix wrong memory footprint statistics in debugfsOur value of memory footprint statistics showed in debugfs is not calculated correctly. Fix it in this patch.
Signed-off-by Chao Yu <[email protected]>--- fs/f2fs/debug.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)fs/f2fs/debug.c +11
-4@@ -163,13 +163,20 @@ static void update_mem_info(struct f2fs_sb_info *sbi) si->base_mem +=sizeof (struct f2fs_nm_info ); si->base_mem +=__bitmap_size (sbi,NAT_BITMAP ); +get_cache: + si->cache_mem =0 ; +/* build gc */ - si->base_mem +=sizeof (struct f2fs_gc_kthread ); +if (sbi->gc_thread) + si->cache_mem +=sizeof (struct f2fs_gc_kthread ); + +/* build merge flush thread */ +if (SM_I (sbi)->cmd_control_info) + si->cache_mem +=sizeof (struct flush_cmd_control ); -get_cache:/* free nids */ - si->cache_mem =NM_I (sbi)->fcnt; - si->cache_mem +=NM_I (sbi)->nat_cnt; + si->cache_mem +=NM_I (sbi)->fcnt *sizeof (struct free_nid ); + si->cache_mem +=NM_I (sbi)->nat_cnt *sizeof (struct nat_entry ); npages =NODE_MAPPING (sbi)->nrpages; si->cache_mem += npages <<PAGE_CACHE_SHIFT ; npages =META_MAPPING (sbi)->nrpages;Signature · 1 line
2.2.1