From: Matthew Wilcox <willy@infradead.org>
To: "Vishal Moola (Oracle)" <vishal.moola@gmail.com>
Cc: akpm@linux-foundation.org, hughd@google.com,
linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] filemap: find_lock_entries() now updates start offset
Date: Wed, 12 Oct 2022 03:10:26 +0100 [thread overview]
Message-ID: <Y0YiEon0G3b/00dG@casper.infradead.org> (raw)
In-Reply-To: <20221011215634.478330-2-vishal.moola@gmail.com>
On Tue, Oct 11, 2022 at 02:56:31PM -0700, Vishal Moola (Oracle) wrote:
> @@ -2116,7 +2118,16 @@ unsigned find_lock_entries(struct address_space *mapping, pgoff_t start,
> folio_put(folio);
> }
> rcu_read_unlock();
> + nr = folio_batch_count(fbatch);
> +
> + if (nr) {
> + folio = fbatch->folios[nr - 1];
> + nr = folio_nr_pages(folio);
>
> + if (folio_test_hugetlb(folio))
> + nr = 1;
> + *start = folio->index + nr;
> + }
Hmm ... this is going to go wrong if the folio is actually a shadow
entry, isn't it?
> +++ b/mm/shmem.c
> @@ -922,21 +922,18 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
>
> folio_batch_init(&fbatch);
> index = start;
> - while (index < end && find_lock_entries(mapping, index, end - 1,
> + while (index < end && find_lock_entries(mapping, &index, end - 1,
> &fbatch, indices)) {
> for (i = 0; i < folio_batch_count(&fbatch); i++) {
> folio = fbatch.folios[i];
>
> - index = indices[i];
> -
> if (xa_is_value(folio)) {
> if (unfalloc)
> continue;
> nr_swaps_freed += !shmem_free_swap(mapping,
> - index, folio);
> + folio->index, folio);
We know this is a value entry, so we definitely can't look at
folio->index. This should probably be:
+ indices[i], folio);
> @@ -510,20 +509,18 @@ unsigned long invalidate_mapping_pagevec(struct address_space *mapping,
> int i;
>
> folio_batch_init(&fbatch);
> - while (find_lock_entries(mapping, index, end, &fbatch, indices)) {
> + while (find_lock_entries(mapping, &index, end, &fbatch, indices)) {
> for (i = 0; i < folio_batch_count(&fbatch); i++) {
> struct folio *folio = fbatch.folios[i];
>
> /* We rely upon deletion not changing folio->index */
> - index = indices[i];
>
> if (xa_is_value(folio)) {
> count += invalidate_exceptional_entry(mapping,
> - index,
> - folio);
> + folio->index,
> + folio);
Same here. I'd fix the indent while you're at it to get more on that
second line and not need a third line.
next prev parent reply other threads:[~2022-10-12 2:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 21:56 [PATCH 0/4] Rework find_get_entries() and find_lock_entries() Vishal Moola (Oracle)
2022-10-11 21:56 ` [PATCH 1/4] filemap: find_lock_entries() now updates start offset Vishal Moola (Oracle)
2022-10-12 2:10 ` Matthew Wilcox [this message]
2022-10-12 16:02 ` Vishal Moola
2022-10-11 21:56 ` [PATCH 2/4] filemap: find_get_entries() " Vishal Moola (Oracle)
2022-10-11 21:56 ` [PATCH 3/4] truncate: Remove indices argument from truncate_folio_batch_exceptionals() Vishal Moola (Oracle)
2022-10-11 21:56 ` [PATCH 4/4] filemap: Remove indices argument from find_lock_entries() and find_get_entries() Vishal Moola (Oracle)
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=Y0YiEon0G3b/00dG@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=hughd@google.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=vishal.moola@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).