From: Jingbo Xu <jefflexu@linux.alibaba.com>
To: Dave Chinner <david@fromorbit.com>
Cc: axboe@kernel.dk, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org, brauner@kernel.org,
linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk
Subject: Re: [PATCH 2/2] mm/truncate: don't skip dirty page in folio_unmap_invalidate()
Date: Wed, 19 Feb 2025 09:55:08 +0800 [thread overview]
Message-ID: <fefdb1f7-bf14-4bae-8666-132d1ceaed66@linux.alibaba.com> (raw)
In-Reply-To: <Z7UhllvPUxVuYOqf@dread.disaster.area>
On 2/19/25 8:11 AM, Dave Chinner wrote:
> On Tue, Feb 18, 2025 at 08:02:09PM +0800, Jingbo Xu wrote:
>> ... otherwise this is a behavior change for the previous callers of
>> invalidate_complete_folio2(), e.g. the page invalidation routine.
>>
>> Fixes: 4a9e23159fd3 ("mm/truncate: add folio_unmap_invalidate() helper")
>> Signed-off-by: Jingbo Xu <jefflexu@linux.alibaba.com>
>> ---
>> mm/truncate.c | 2 --
>> 1 file changed, 2 deletions(-)
>>
>> diff --git a/mm/truncate.c b/mm/truncate.c
>> index e2e115adfbc5..76d8fcd89bd0 100644
>> --- a/mm/truncate.c
>> +++ b/mm/truncate.c
>> @@ -548,8 +548,6 @@ int folio_unmap_invalidate(struct address_space *mapping, struct folio *folio,
>>
>> VM_BUG_ON_FOLIO(!folio_test_locked(folio), folio);
>>
>> - if (folio_test_dirty(folio))
>> - return 0;
>
> Shouldn't that actually return -EBUSY because the folio could not be
> invalidated?
>
> Indeed, further down the function the folio gets locked and the
> dirty test is repeated. If it fails there it returns -EBUSY....
>
> -Dave.
Yeah, the original logic of invalidate_inode_pages2_range() is like
```
invalidate_inode_pages2_range
# lock page
# launder the page if it's dirty
invalidate_complete_folio2
# recheck if it's dirty, and skip the dirty page (no idea how page
could be redirtied after launder_page())
```
while after commit 4a9e23159fd3 ("mm/truncate: add
folio_unmap_invalidate() helper"), this logic is changed to:
```
invalidate_inode_pages2_range
# lock page
folio_unmap_invalidate
# check if it's dirty, and skip dirty page
# launder the page if it's dirty (doubt if it's noops)
# recheck if it's dirty, and skip the dirty page
```
--
Thanks,
Jingbo
next prev parent reply other threads:[~2025-02-19 1:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-18 12:02 [PATCH 0/2] fixes for uncached IO Jingbo Xu
2025-02-18 12:02 ` [PATCH 1/2] mm/filemap: fix miscalculated file range for filemap_fdatawrite_range_kick() Jingbo Xu
2025-02-19 16:25 ` Jens Axboe
2025-02-18 12:02 ` [PATCH 2/2] mm/truncate: don't skip dirty page in folio_unmap_invalidate() Jingbo Xu
2025-02-18 12:32 ` Kirill A. Shutemov
2025-02-19 1:23 ` Jingbo Xu
2025-02-19 16:23 ` Jens Axboe
2025-02-19 0:11 ` Dave Chinner
2025-02-19 1:55 ` Jingbo Xu [this message]
2025-02-21 11:09 ` [PATCH 0/2] fixes for uncached IO Jingbo Xu
2025-02-21 13:10 ` Christian Brauner
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=fefdb1f7-bf14-4bae-8666-132d1ceaed66@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=axboe@kernel.dk \
--cc=brauner@kernel.org \
--cc=david@fromorbit.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=viro@zeniv.linux.org.uk \
/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