From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.130 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793603388; b=zNpEMtdevGICJne3k4W0/zfB1b9mCMqyB20odVB8BhK3bo2xSLzjic91RCr74JHer/M8 677wrJPzXDk20ClLx7u2s/DQejn8IcW8clG6NrChexbdgJQZ/ZRtLKEjQvYv/r827Rgtp sxIebxR8IF7olGi2RnkBlqTTePkCLH8MpZZuVexojfokU1g+Y+Ohzq9MBdgdsbitAdp4Y CR1bBJJUVzy34hlyS0rvB/xoShJVROtA6OyCXbW3Qbg0PqBzKI01jkZBdXH5mEEqNO+Lb Z0gCnvxkbHeRdy4FfJqyKSm7GV/Ddnkq558jljK3WlJIrpmrJ5lNdDVDeW7xOjMsRqQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793603388; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References:From: In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=2fO+hC9G2Gl1xqrTCPgoZEeJNl9zikfHS4tc4D1yVE4=; b=DVseVfoXssyh2pWtlqttkK7qU4X5mq+Ob1f0mrXMVdCgH9W6T+KUVDeLL3ISclHam0iz QEF/N06MR/n2wDhsH1hP53XzAYXdZ7+KvB3sRuRI/e4yOpD1+08nXmkIpBZB+6YvsVvBN h8xPC6z49G8OztbaEbEPOLJ4TB6QA8P6DHsNzmNpKvsy3Pe4BTySmUQssYLHF4ssyt/PC fPyZ54q2IdnPi8rqcJme83AcDPZYs2UQRlpk3SdjbLwjGpt59FWtsSqidVKbdorfIxxH8 0hG/8PI7ws3gVB2vAY2CQQxzrefpwgdVXv1bZ5gV5FkzD3TKexVpZKzoEP+9NCXwKfw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=NZ7mLZNI; arc=none smtp.remote-ip=115.124.30.130 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7F5AD606A327; Mon, 2 Nov 2026 07:09:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7F5AD606A327 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, unprotected) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=NZ7mLZNI DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1793603381; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=2fO+hC9G2Gl1xqrTCPgoZEeJNl9zikfHS4tc4D1yVE4=; b=NZ7mLZNI8uJQaeSYoIVETAzHJapvJamo75sSzNds4uSjfhDqrTaqPehrMJ60C5rszlMXPDweu4AEH4jEF1C9ZCY4BmwceyeJX4+umUKxriKfLXKKyEY/mkB4LmiFHFkr0N9gxbLqutB4xXoI6DG/bGZ22MiHdOO3XcqUwWJSKTg= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R371e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037009110;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=66;SR=0;TI=SMTPD_---0XDudPio_1793603375; Received: from 30.74.144.167(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0XDudPio_1793603375 cluster:ay36) by smtp.aliyun-inc.com; Mon, 02 Nov 2026 15:09:37 +0800 Message-ID: <166bcddc-1a03-421d-9cc0-92b5a0159d69@linux.alibaba.com> Date: Mon, 2 Nov 2026 15:09:35 +0800 X-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 15/47] mm/khugepaged: always recheck the pmd in try_collapse_pte_mapped_thp() To: "David Hildenbrand (Arm)" , Andrew Morton , Johannes Weiner , Michal Hocko , Qi Zheng , Shakeel Butt , Lorenzo Stoakes , Kairui Song , Barry Song , Axel Rasmussen , Yuanchu Xie , Wei Xu , Baoquan He , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Kees Cook , Peter Zijlstra , Jann Horn , Pedro Falcato , Hugh Dickins , Pasha Tatashin , Pratyush Yadav , "Matthew Wilcox (Oracle)" , Jan Kara , Zi Yan , Lance Yang , Rik van Riel , Harry Yoo , Alistair Popple , Nico Pache , Ryan Roberts , Dev Jain , Usama Arif , Kiryl Shutsemau , Matthew Brost , John Hubbard , Peter Xu , Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Oscar Salvador , Minchan Kim , Muchun Song , Xu Xin , Chengming Zhou , Chris Li , Kemeng Shi , Nhat Pham , Youngjun Park , Gregory Price , Joshua Hahn , Rakie Kim , Ying Huang , Jason Gunthorpe Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-fsdevel@vger.kernel.org, linux-arch@vger.kernel.org, linux-cxl@vger.kernel.org, Josef Bacik , stable@vger.kernel.org, Muhammad Usama Anjum References: <20261031-fixes_core-v3-0-d6437171ecc3@kernel.org> <20261031-fixes_core-v3-15-d6437171ecc3@kernel.org> From: Baolin Wang In-Reply-To: <20261031-fixes_core-v3-15-d6437171ecc3@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10/31/26 5:39 PM, David Hildenbrand (Arm) wrote: > From: Josef Bacik > > try_collapse_pte_mapped_thp() drops the PTE lock after it has cleared the > page table, and takes the PMD lock and the PTE lock to remove it. > > In between, MADV_DONTNEED with CONFIG_PT_RECLAIM can reclaim the > page table. The pmd_same() check is supposed to handle this, but it is > only done with CONFIG_SPLIT_PTE_PTLOCKS. > > Fix it by performing the check unconditionally. > > Fix generated by an LLM and sent by Josef Bacik in private. > > Fixes: 6375e95f381e ("mm: pgtable: reclaim empty PTE page in madvise(MADV_DONTNEED)") > Cc: stable@vger.kernel.org > Signed-off-by: Josef Bacik > [ david: adjust description ] > Reviewed-by: Gregory Price (Meta) > Tested-by: Gregory Price (Meta) > Tested-by: Muhammad Usama Anjum > Signed-off-by: David Hildenbrand (Arm) > --- LGTM. Reviewed-by: Baolin Wang