* [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs
@ 2015-01-06 8:40 Chao Yu
2015-01-06 19:48 ` [PATCH] " Jaegeuk Kim
0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2015-01-06 8:40 UTC (permalink / raw)
To: Jaegeuk Kim, Changman Lee; +Cc: linux-f2fs-devel, linux-kernel
Our value of memory footprint statistics showed in debugfs is not calculated
correctly. Fix it in this patch.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
fs/f2fs/debug.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index dd7835b..6aeaf46 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -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;
--
2.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] f2fs: fix wrong memory footprint statistics in debugfs
2015-01-06 8:40 [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs Chao Yu
@ 2015-01-06 19:48 ` Jaegeuk Kim
2015-01-10 12:09 ` [f2fs-dev][PATCH] " Chao Yu
0 siblings, 1 reply; 4+ messages in thread
From: Jaegeuk Kim @ 2015-01-06 19:48 UTC (permalink / raw)
To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel
Hi Chao,
On Tue, Jan 06, 2015 at 04:40:49PM +0800, Chao Yu wrote:
> Our value of memory footprint statistics showed in debugfs is not calculated
> correctly. Fix it in this patch.
>
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
> fs/f2fs/debug.c | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> index dd7835b..6aeaf46 100644
> --- a/fs/f2fs/debug.c
> +++ b/fs/f2fs/debug.c
> @@ -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);
It seems base_mem increases repeatedly?
>
> -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.
> npages = NODE_MAPPING(sbi)->nrpages;
> si->cache_mem += npages << PAGE_CACHE_SHIFT;
> npages = META_MAPPING(sbi)->nrpages;
> --
> 2.2.1
------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs
2015-01-06 19:48 ` [PATCH] " Jaegeuk Kim
@ 2015-01-10 12:09 ` Chao Yu
2015-01-11 5:35 ` Jaegeuk Kim
0 siblings, 1 reply; 4+ messages in thread
From: Chao Yu @ 2015-01-10 12:09 UTC (permalink / raw)
To: 'Jaegeuk Kim'
Cc: 'Changman Lee', linux-f2fs-devel, linux-kernel
Hi Jaegeuk,
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Wednesday, January 07, 2015 3:49 AM
> To: Chao Yu
> Cc: Changman Lee; linux-f2fs-devel@lists.sourceforge.net; linux-kernel@vger.kernel.org
> Subject: Re: [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs
>
> Hi Chao,
>
> On Tue, Jan 06, 2015 at 04:40:49PM +0800, Chao Yu wrote:
> > Our value of memory footprint statistics showed in debugfs is not calculated
> > correctly. Fix it in this patch.
> >
> > Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> > ---
> > fs/f2fs/debug.c | 15 ++++++++++-----
> > 1 file changed, 10 insertions(+), 5 deletions(-)
> >
> > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> > index dd7835b..6aeaf46 100644
> > --- a/fs/f2fs/debug.c
> > +++ b/fs/f2fs/debug.c
> > @@ -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);
>
> It seems base_mem increases repeatedly?
Right, my mistaken. How about counting memory of these two cache into cache_mem
as following?
>From edfa0beaed83ebfec34b07bfcb5e8ce3cdcb0858 Mon Sep 17 00:00:00 2001
From: Chao Yu <chao2.yu@samsung.com>
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.
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
fs/f2fs/debug.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
index 1f0fb58..b45daab 100644
--- a/fs/f2fs/debug.c
+++ b/fs/f2fs/debug.c
@@ -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;
--
2.2.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs
2015-01-10 12:09 ` [f2fs-dev][PATCH] " Chao Yu
@ 2015-01-11 5:35 ` Jaegeuk Kim
0 siblings, 0 replies; 4+ messages in thread
From: Jaegeuk Kim @ 2015-01-11 5:35 UTC (permalink / raw)
To: Chao Yu; +Cc: 'Changman Lee', linux-f2fs-devel, linux-kernel
On Sat, Jan 10, 2015 at 08:09:52PM +0800, Chao Yu wrote:
> Hi Jaegeuk,
>
> > -----Original Message-----
> > From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> > Sent: Wednesday, January 07, 2015 3:49 AM
> > To: Chao Yu
> > Cc: Changman Lee; linux-f2fs-devel@lists.sourceforge.net; linux-kernel@vger.kernel.org
> > Subject: Re: [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs
> >
> > Hi Chao,
> >
> > On Tue, Jan 06, 2015 at 04:40:49PM +0800, Chao Yu wrote:
> > > Our value of memory footprint statistics showed in debugfs is not calculated
> > > correctly. Fix it in this patch.
> > >
> > > Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> > > ---
> > > fs/f2fs/debug.c | 15 ++++++++++-----
> > > 1 file changed, 10 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> > > index dd7835b..6aeaf46 100644
> > > --- a/fs/f2fs/debug.c
> > > +++ b/fs/f2fs/debug.c
> > > @@ -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);
> >
> > It seems base_mem increases repeatedly?
>
> Right, my mistaken. How about counting memory of these two cache into cache_mem
> as following?
Looks good to me. :)
Thanks,
>
> >From edfa0beaed83ebfec34b07bfcb5e8ce3cdcb0858 Mon Sep 17 00:00:00 2001
> From: Chao Yu <chao2.yu@samsung.com>
> 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.
>
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>
> ---
> fs/f2fs/debug.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
>
> diff --git a/fs/f2fs/debug.c b/fs/f2fs/debug.c
> index 1f0fb58..b45daab 100644
> --- a/fs/f2fs/debug.c
> +++ b/fs/f2fs/debug.c
> @@ -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;
> --
> 2.2.1
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-11 5:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-06 8:40 [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs Chao Yu
2015-01-06 19:48 ` [PATCH] " Jaegeuk Kim
2015-01-10 12:09 ` [f2fs-dev][PATCH] " Chao Yu
2015-01-11 5:35 ` Jaegeuk Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).