public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao2.yu@samsung.com>
Cc: Changman Lee <cm224.lee@samsung.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [f2fs-dev][PATCH] f2fs: fix wrong memory footprint statistics in debugfs
Date: Tue, 6 Jan 2015 11:48:34 -0800	[thread overview]
Message-ID: <20150106194834.GC54001@jaegeuk-mac02> (raw)
In-Reply-To: <009c01d0298c$946435e0$bd2ca1a0$@samsung.com>

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

  reply	other threads:[~2015-01-06 19:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2015-01-10 12:09   ` Chao Yu
2015-01-11  5:35     ` Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150106194834.GC54001@jaegeuk-mac02 \
    --to=jaegeuk@kernel.org \
    --cc=chao2.yu@samsung.com \
    --cc=cm224.lee@samsung.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox