All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: export compress_percent and compress_watermark entries
Date: Wed, 18 Jan 2023 18:29:57 -0800	[thread overview]
Message-ID: <Y8irJdc4vTCC9gKj@google.com> (raw)
In-Reply-To: <20230117131740.76597-1-frank.li@vivo.com>

On 01/17, Yangtao Li wrote:
> This patch export below sysfs entries for better control cached
> compress page count.
> 
> /sys/fs/f2fs/<disk>/compress_watermark
> /sys/fs/f2fs/<disk>/compress_percent
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  Documentation/ABI/testing/sysfs-fs-f2fs | 17 +++++++++++++++++
>  fs/f2fs/sysfs.c                         | 18 ++++++++++++++++++
>  2 files changed, 35 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 75420c242cc4..920562742655 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -717,3 +717,20 @@ Description:	Controls background discard granularity of inner discard thread
>  		is smaller than granularity. The unit size is one block(4KB), now only
>  		support configuring in range of [0, 512].
>  		Default: 512
> +
> +what:		/sys/fs/f2fs/<disk>/compress_watermark
> +date:		january 2023
> +contact:	"yangtao li" <frank.li@vivo.com>
> +description:	when compress_cache is on, it controls free memory watermark
> +		in order to limit caching compress page. If free memory is lower
> +		than watermark, then deny caching compress page. The value should be in
> +		range of [0, 100], by default it was initialized as 20(%).
> +
> +what:		/sys/fs/f2fs/<disk>/compress_percent
> +date:		january 2023
> +contact:	"yangtao li" <frank.li@vivo.com>
> +description:	when compress_cache is on, it controls cached page
> +		percent(compress pages / free_ram) in order to limit caching compress page.
> +		If cached page percent exceed threshold, then deny caching compress page.
> +		The value should be in range of [0, 100], by default it was initialized
> +		as 20(%).
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index e396851a6dd1..37c6ef080f7e 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -598,6 +598,20 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
>  		sbi->compr_new_inode = 0;
>  		return count;
>  	}
> +
> +	if (!strcmp(a->attr.name, "compress_percent")) {
> +		if (t > 100)

t=0 also doesn't make sense.

> +			return -EINVAL;
> +		*ui = t;
> +		return count;
> +	}
> +
> +	if (!strcmp(a->attr.name, "compress_watermark")) {
> +		if (t > 100)
> +			return -EINVAL;
> +		*ui = t;
> +		return count;
> +	}
>  #endif
>  
>  	if (!strcmp(a->attr.name, "atgc_candidate_ratio")) {
> @@ -932,6 +946,8 @@ F2FS_FEATURE_RO_ATTR(compression);
>  F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_written_block, compr_written_block);
>  F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_saved_block, compr_saved_block);
>  F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_new_inode, compr_new_inode);
> +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_percent, compress_percent);
> +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_watermark, compress_watermark);
>  #endif
>  F2FS_FEATURE_RO_ATTR(pin_file);
>  
> @@ -1038,6 +1054,8 @@ static struct attribute *f2fs_attrs[] = {
>  	ATTR_LIST(compr_written_block),
>  	ATTR_LIST(compr_saved_block),
>  	ATTR_LIST(compr_new_inode),
> +	ATTR_LIST(compress_percent),
> +	ATTR_LIST(compress_watermark),
>  #endif
>  	/* For ATGC */
>  	ATTR_LIST(atgc_candidate_ratio),
> -- 
> 2.25.1


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Yangtao Li <frank.li@vivo.com>
Cc: chao@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] f2fs: export compress_percent and compress_watermark entries
Date: Wed, 18 Jan 2023 18:29:57 -0800	[thread overview]
Message-ID: <Y8irJdc4vTCC9gKj@google.com> (raw)
In-Reply-To: <20230117131740.76597-1-frank.li@vivo.com>

On 01/17, Yangtao Li wrote:
> This patch export below sysfs entries for better control cached
> compress page count.
> 
> /sys/fs/f2fs/<disk>/compress_watermark
> /sys/fs/f2fs/<disk>/compress_percent
> 
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  Documentation/ABI/testing/sysfs-fs-f2fs | 17 +++++++++++++++++
>  fs/f2fs/sysfs.c                         | 18 ++++++++++++++++++
>  2 files changed, 35 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-fs-f2fs b/Documentation/ABI/testing/sysfs-fs-f2fs
> index 75420c242cc4..920562742655 100644
> --- a/Documentation/ABI/testing/sysfs-fs-f2fs
> +++ b/Documentation/ABI/testing/sysfs-fs-f2fs
> @@ -717,3 +717,20 @@ Description:	Controls background discard granularity of inner discard thread
>  		is smaller than granularity. The unit size is one block(4KB), now only
>  		support configuring in range of [0, 512].
>  		Default: 512
> +
> +what:		/sys/fs/f2fs/<disk>/compress_watermark
> +date:		january 2023
> +contact:	"yangtao li" <frank.li@vivo.com>
> +description:	when compress_cache is on, it controls free memory watermark
> +		in order to limit caching compress page. If free memory is lower
> +		than watermark, then deny caching compress page. The value should be in
> +		range of [0, 100], by default it was initialized as 20(%).
> +
> +what:		/sys/fs/f2fs/<disk>/compress_percent
> +date:		january 2023
> +contact:	"yangtao li" <frank.li@vivo.com>
> +description:	when compress_cache is on, it controls cached page
> +		percent(compress pages / free_ram) in order to limit caching compress page.
> +		If cached page percent exceed threshold, then deny caching compress page.
> +		The value should be in range of [0, 100], by default it was initialized
> +		as 20(%).
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index e396851a6dd1..37c6ef080f7e 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -598,6 +598,20 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
>  		sbi->compr_new_inode = 0;
>  		return count;
>  	}
> +
> +	if (!strcmp(a->attr.name, "compress_percent")) {
> +		if (t > 100)

t=0 also doesn't make sense.

> +			return -EINVAL;
> +		*ui = t;
> +		return count;
> +	}
> +
> +	if (!strcmp(a->attr.name, "compress_watermark")) {
> +		if (t > 100)
> +			return -EINVAL;
> +		*ui = t;
> +		return count;
> +	}
>  #endif
>  
>  	if (!strcmp(a->attr.name, "atgc_candidate_ratio")) {
> @@ -932,6 +946,8 @@ F2FS_FEATURE_RO_ATTR(compression);
>  F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_written_block, compr_written_block);
>  F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_saved_block, compr_saved_block);
>  F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compr_new_inode, compr_new_inode);
> +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_percent, compress_percent);
> +F2FS_RW_ATTR(F2FS_SBI, f2fs_sb_info, compress_watermark, compress_watermark);
>  #endif
>  F2FS_FEATURE_RO_ATTR(pin_file);
>  
> @@ -1038,6 +1054,8 @@ static struct attribute *f2fs_attrs[] = {
>  	ATTR_LIST(compr_written_block),
>  	ATTR_LIST(compr_saved_block),
>  	ATTR_LIST(compr_new_inode),
> +	ATTR_LIST(compress_percent),
> +	ATTR_LIST(compress_watermark),
>  #endif
>  	/* For ATGC */
>  	ATTR_LIST(atgc_candidate_ratio),
> -- 
> 2.25.1

  reply	other threads:[~2023-01-19  2:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-17 13:17 [f2fs-dev] [PATCH] f2fs: export compress_percent and compress_watermark entries Yangtao Li via Linux-f2fs-devel
2023-01-17 13:17 ` Yangtao Li
2023-01-19  2:29 ` Jaegeuk Kim [this message]
2023-01-19  2:29   ` 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=Y8irJdc4vTCC9gKj@google.com \
    --to=jaegeuk@kernel.org \
    --cc=frank.li@vivo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.