[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <22878093-1EAC-42B3-A962-24204628466B@nvidia.com>
Date: Thu, 23 Oct 2025 13:48:36 -0400
From: Zi Yan <ziy@...dia.com>
To: Kairui Song <ryncsn@...il.com>
Cc: linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Baolin Wang <baolin.wang@...ux.alibaba.com>, Hugh Dickins <hughd@...gle.com>,
Dev Jain <dev.jain@....com>, David Hildenbrand <david@...hat.com>,
Barry Song <baohua@...nel.org>, Liam Howlett <liam.howlett@...cle.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
Mariano Pache <npache@...hat.com>, Matthew Wilcox <willy@...radead.org>,
Ryan Roberts <ryan.roberts@....com>, linux-kernel@...r.kernel.org,
Kairui Song <kasong@...cent.com>, stable@...r.kernel.org
Subject: Re: [PATCH v3] mm/shmem: fix THP allocation and fallback loop
On 23 Oct 2025, at 2:59, Kairui Song wrote:
> From: Kairui Song <kasong@...cent.com>
>
> The order check and fallback loop is updating the index value on every
> loop, this will cause the index to be wrongly aligned by a larger value
> while the loop shrinks the order.
>
> This may result in inserting and returning a folio of the wrong index
> and cause data corruption with some userspace workloads [1].
>
> Cc: stable@...r.kernel.org
> Link: https://lore.kernel.org/linux-mm/CAMgjq7DqgAmj25nDUwwu1U2cSGSn8n4-Hqpgottedy0S6YYeUw@mail.gmail.com/ [1]
> Fixes: e7a2ab7b3bb5d ("mm: shmem: add mTHP support for anonymous shmem")
> Signed-off-by: Kairui Song <kasong@...cent.com>
>
> ---
>
> Changes from V2:
> - Introduce a temporary variable to improve code,
> no behavior change, generated code is identical.
> - Link to V2: https://lore.kernel.org/linux-mm/20251022105719.18321-1-ryncsn@gmail.com/
>
> Changes from V1:
> - Remove unnecessary cleanup and simplify the commit message.
> - Link to V1: https://lore.kernel.org/linux-mm/20251021190436.81682-1-ryncsn@gmail.com/
>
> ---
> mm/shmem.c | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
Acked-by: Zi Yan <ziy@...dia.com>
--
Best Regards,
Yan, Zi
Powered by blists - more mailing lists