From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-111.freemail.mail.aliyun.com (out30-111.freemail.mail.aliyun.com [115.124.30.111]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 845932AD25; Fri, 24 Oct 2025 00:47:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.111 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761266827; cv=none; b=bhLXOvzD+ASYg7Qvjo17V6pURilORUeghu1udpKHLQ21vbRpffrsBQRVXL6OghfpRnC+ij2cz1/QGlpPl4YK5Sr2JhnnTxzgOOJWdOutmuyvHA6bPzGUOCAu4bhIoSALCxnZbDLrLnh0lFb+X/SBrVkCLU6AJSyECgkbtlEGfvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761266827; c=relaxed/simple; bh=1Komk46U4DDiqfl8LUDvzb6I5UokBYd0SRVPy7f13BY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qpf1wkUijzy/NVlqOFHUMw2lLRGtYJ6Mu8u/5DdgZjkhALadRTQTfGo2kHAnFTesg5mWwa0Br4lomSehQ7EqH8PVIRYdBkSo8waKU4VZ5hIagiSqVxsKr6WFN5Ncno8FEfwe1pNcwxM3oXAOLzeAG3n6wJ6BhgIh6wO6MwVLb3U= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=DfLaWJ72; arc=none smtp.client-ip=115.124.30.111 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="DfLaWJ72" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1761266821; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=9qJamjzk22RA6jKfjKnU6G0J/c4HWnTcWAnWK01wqPs=; b=DfLaWJ72PrWDIU+dYST8GwvCzvGtTVIwnn3CVHRWNp8lSdNS+CLFXD6enIQKJe86YkHdBCRUiZ2Xk/UY0SS9+h+rg30JlwZ55ulnZZePpSzcWn/UPWkjMEaZaMAmZpDL927Cdm/Ne6X4+UOn+TSHX376Aj1QOs0KHThwe02XSw8= Received: from 30.74.144.122(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WqsGyEe_1761266819 cluster:ay36) by smtp.aliyun-inc.com; Fri, 24 Oct 2025 08:46:59 +0800 Message-ID: <6a0cd943-a3cf-41fe-b666-47d250413a77@linux.alibaba.com> Date: Fri, 24 Oct 2025 08:46:58 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3] mm/shmem: fix THP allocation and fallback loop To: Kairui Song , linux-mm@kvack.org Cc: Andrew Morton , Hugh Dickins , Dev Jain , David Hildenbrand , Barry Song , Liam Howlett , Lorenzo Stoakes , Mariano Pache , Matthew Wilcox , Ryan Roberts , Zi Yan , linux-kernel@vger.kernel.org, Kairui Song , stable@vger.kernel.org References: <20251023065913.36925-1-ryncsn@gmail.com> From: Baolin Wang In-Reply-To: <20251023065913.36925-1-ryncsn@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025/10/23 14:59, Kairui Song wrote: > From: Kairui Song > > 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@vger.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 > > --- LGTM. Thanks. Reviewed-by: Baolin Wang