From: David Hildenbrand <david@redhat.com>
To: Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] mm: shmem: fix minor off-by-one in shrinkable calculation
Date: Mon, 26 Aug 2024 08:48:59 +0200 [thread overview]
Message-ID: <efeee548-fb6f-4670-880b-f0837614b5cb@redhat.com> (raw)
In-Reply-To: <d8e75079-af2d-8519-56df-6be1dccc247a@google.com>
On 26.08.24 00:42, Hugh Dickins wrote:
> There has been a long-standing and very minor off-by-one, where
> shmem_get_folio_gfp() decides if a large folio extends beyond i_size
> far enough to leave a page or more for freeing later under pressure.
>
> This is not something needed for stable: but it will be proportionately
> more significant as support for smaller large folios is added, and is
> best fixed before duplicating the check in other places.
>
> Fixes: 779750d20b93 ("shmem: split huge pages beyond i_size under memory pressure")
> Signed-off-by: Hugh Dickins <hughd@google.com>
> ---
> mm/shmem.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 85e3bd3e709e..37c300f69baf 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -2326,7 +2326,7 @@ static int shmem_get_folio_gfp(struct inode *inode, pgoff_t index,
> alloced = true;
> if (folio_test_large(folio) &&
> DIV_ROUND_UP(i_size_read(inode), PAGE_SIZE) <
> - folio_next_index(folio) - 1) {
> + folio_next_index(folio)) {
> struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb);
> struct shmem_inode_info *info = SHMEM_I(inode);
> /*
Reviewed-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
next prev parent reply other threads:[~2024-08-26 6:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-25 22:42 [PATCH] mm: shmem: fix minor off-by-one in shrinkable calculation Hugh Dickins
2024-08-26 6:48 ` David Hildenbrand [this message]
2024-08-27 7:14 ` 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=efeee548-fb6f-4670-880b-f0837614b5cb@redhat.com \
--to=david@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).