From: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
To: "David Hildenbrand (Arm)" <david@kernel.org>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>, linux-mm@kvack.org
Subject: Re: [PATCH v2] mm/shmem: don't allocate the replacement folio with the folio locked
Date: Thu, 3 Dec 2026 11:46:20 +0100 [thread overview]
Message-ID: <b8314367-a53e-4d2e-ae1f-03fc70ecd063@gmail.com> (raw)
In-Reply-To: <58f4b1fc-1a99-4a30-b9b7-347475a2cf4e@kernel.org>
On 12/3/26 9:39 AM, David Hildenbrand (Arm) wrote:
>> @@ -2636,6 +2639,9 @@ static int shmem_swapin_folio(struct inode *inode, pgoff_t index,
>> index = round_down(index, nr_pages);
>> }
>>
>> + if (shmem_should_replace_folio(folio, gfp))
>
> Can we cache the result and reuse below?
>
sure, will do in v3.
> Or even better, check for "new" below instead of shmem_should_replace_folio(). I
> think that then nicely matches the "new = NULL;"
>
> That means we would move the
>
> if (!new)
> return -ENOMEM;
>
> out of shmem_replace_folio() here.
>
> Is there something that would prevent that?
>
> Would look cleaner to me.
>
>
yes, that's the early -ENOMEM from v1, it skips the swap entry checks
Baolin pointed out..
--
cheers,
jose a. p-a
prev parent reply other threads:[~2026-12-03 10:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 22:19 [PATCH v2] mm/shmem: don't allocate the replacement folio with the folio locked Jose A. Perez de Azpillaga
2026-12-03 8:39 ` David Hildenbrand (Arm)
2026-12-03 10:46 ` Jose A. Perez de Azpillaga [this message]
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=b8314367-a53e-4d2e-ae1f-03fc70ecd063@gmail.com \
--to=azpijr@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=david@kernel.org \
--cc=hughd@google.com \
--cc=linux-mm@kvack.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