linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Kefeng Wang <wangkefeng.wang@huawei.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Hugh Dickins <hughd@google.com>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>,
	Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
	Matthew Wilcox <willy@infradead.org>,
	linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
	David Hildenbrand <david@redhat.com>
Subject: Re: [PATCH v3] tmpfs: don't enable large folios if not supported
Date: Sat, 12 Oct 2024 11:59:37 +0800	[thread overview]
Message-ID: <f29f5635-ed4d-49a6-957b-868c9d07e577@linux.alibaba.com> (raw)
In-Reply-To: <20241011065919.2086827-1-wangkefeng.wang@huawei.com>



On 2024/10/11 14:59, Kefeng Wang wrote:
> The tmpfs could support large folio, but there is some configurable
> options(mount options and runtime deny/force) to enable/disable large
> folio allocation, so there is a performance issue when perform write
> without large folio, the issue is similar to commit 4e527d5841e2
> ("iomap: fault in smaller chunks for non-large folio mappings").
> 
> Don't call mapping_set_large_folios() in __shmem_get_inode() when
> large folio is disabled to fix it.
> 
> Fixes: 9aac777aaf94 ("filemap: Convert generic_perform_write() to support large folios")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> 
> v3:
> - don't enable large folio suppport in __shmem_get_inode() if disabled,
>    suggested by Matthew.
> 
> v2:
> - Don't use IOCB flags
> 
>   mm/shmem.c | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 0a2f78c2b919..2b859ac4ddc5 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2850,7 +2850,10 @@ static struct inode *__shmem_get_inode(struct mnt_idmap *idmap,
>   	cache_no_acl(inode);
>   	if (sbinfo->noswap)
>   		mapping_set_unevictable(inode->i_mapping);
> -	mapping_set_large_folios(inode->i_mapping);
> +
> +	if ((sbinfo->huge && shmem_huge != SHMEM_HUGE_DENY) ||
> +	    shmem_huge == SHMEM_HUGE_FORCE)
> +		mapping_set_large_folios(inode->i_mapping);

IMHO, I'm still a little concerned about the 'shmem_huge' validation. 
Since the 'shmem_huge' can be set at runtime, that means file mapping 
with 'huge=always' option might miss the opportunity to allocate large 
folios if the 'shmem_huge' is changed from 'deny' from 'always' at runtime.

So I'd like to drop the 'shmem_huge' validation and add some comments to 
indicate 'deny' and 'force' options are only for testing purpose and 
performence issue should not be a problem in the real production 
environments.

That's just my 2 cents:)


  reply	other threads:[~2024-10-12  3:59 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-14 14:06 [PATCH -next] tmpfs: fault in smaller chunks if large folio allocation not allowed Kefeng Wang
2024-09-15 10:40 ` Matthew Wilcox
2024-09-18  3:55   ` Kefeng Wang
2024-09-20 14:36 ` [PATCH v2] " Kefeng Wang
2024-09-22  0:35   ` Matthew Wilcox
2024-09-23  1:39     ` Kefeng Wang
2024-09-26  8:38       ` Pankaj Raghav (Samsung)
2024-09-26 13:52         ` Matthew Wilcox
2024-09-26 14:20           ` Kefeng Wang
2024-09-26 14:58             ` Matthew Wilcox
2024-09-30  1:27               ` Kefeng Wang
2024-09-30  2:02           ` Baolin Wang
2024-09-30  2:30             ` Kefeng Wang
2024-09-30  2:52               ` Baolin Wang
2024-09-30  3:15                 ` Kefeng Wang
2024-09-30  6:48                   ` Baolin Wang
2024-10-09  7:09                     ` Kefeng Wang
2024-10-09  8:52                       ` Baolin Wang
2024-10-11  6:59   ` [PATCH v3] tmpfs: don't enable large folios if not supported Kefeng Wang
2024-10-12  3:59     ` Baolin Wang [this message]
2024-10-14  2:36       ` Kefeng Wang
2024-10-17 14:17   ` [PATCH v4] " Kefeng Wang
2024-10-18  1:48     ` Baolin Wang

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=f29f5635-ed4d-49a6-957b-868c9d07e577@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=brauner@kernel.org \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wangkefeng.wang@huawei.com \
    --cc=willy@infradead.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