From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Hugh Dickins <hughd@google.com>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Anna Schumaker <Anna.Schumaker@netapp.com>,
<linux-fsdevel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH -next] tmpfs: fault in smaller chunks if large folio allocation not allowed
Date: Wed, 18 Sep 2024 11:55:42 +0800 [thread overview]
Message-ID: <1c8c7401-e68d-4636-923d-57bb31f33a3d@huawei.com> (raw)
In-Reply-To: <Zua5mDwhm7RlC0MS@casper.infradead.org>
On 2024/9/15 18:40, Matthew Wilcox wrote:
> On Sat, Sep 14, 2024 at 10:06:13PM +0800, Kefeng Wang wrote:
>> +++ b/mm/shmem.c
>> @@ -3228,6 +3228,7 @@ static ssize_t shmem_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>> {
>> struct file *file = iocb->ki_filp;
>> struct inode *inode = file->f_mapping->host;
>> + pgoff_t index = iocb->ki_pos >> PAGE_SHIFT;
>> ssize_t ret;
>>
>> inode_lock(inode);
>> @@ -3240,6 +3241,10 @@ static ssize_t shmem_file_write_iter(struct kiocb *iocb, struct iov_iter *from)
>> ret = file_update_time(file);
>> if (ret)
>> goto unlock;
>> +
>> + if (!shmem_allowable_huge_orders(inode, NULL, index, 0, false))
>> + iocb->ki_flags |= IOCB_NO_LARGE_CHUNK;
>
> Wouldn't it be better to call mapping_set_folio_order_range() so we
> don't need this IOCB flag?
>
I think it before, but the comment of mapping_set_folio_order_range() said,
"The filesystem should call this function in its inode constructor to
indicate which base size (min) and maximum size (max) of folio the VFS
can use to cache the contents of the file. This should only be used
if the filesystem needs special handling of folio sizes (ie there is
something the core cannot know).
Do not tune it based on, eg, i_size.
Context: This should not be called while the inode is active as it
is non-atomic."
and dynamically modify mappings without protect maybe a risk.
Or adding a new __generic_perform_write() with a chunk_size argument to
avoid to use a IOCB flag?
next prev parent reply other threads:[~2024-09-18 3:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-14 14:06 Kefeng Wang
2024-09-15 10:40 ` Matthew Wilcox
2024-09-18 3:55 ` Kefeng Wang [this message]
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
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=1c8c7401-e68d-4636-923d-57bb31f33a3d@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=Anna.Schumaker@netapp.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--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=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