From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-179.mta0.migadu.com (out-179.mta0.migadu.com [91.218.175.179]) (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 978A634DB56 for ; Thu, 18 Jun 2026 09:09:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781773789; cv=none; b=Lvqiki/Q0sDebjPuuJvQHYpsJxi/KxPTtUYxrKlza4aX2ZF3xbSOgX7tDzlunBwM+i4YO4h39DJ9JxIBRmqMYZvpCrRn69wdJMl0wsX6UBRhKLiYEAXS/Rpo9wmny2cX1FOyVPQFihkG9dUChbRFzJibyCTAhXPz3wh3HnPFGcE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781773789; c=relaxed/simple; bh=SBZ4OYa+dEzRNG+MGYJcDvsdGiI0d7l1WijzA9Zt/70=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=OE7E2Bxg12/JuSfdeIG033UXgele9/j899HOLr2R30LOzUjxWuFdcob6rI0QNvl2SdhB8InDOzVAXInPcwRauVOYqWK1H8PRLnR9iwS4/UBGH48xSHev8ziDEGUClTPtbSNxjgfSKu2gEed3YT3Z5i2gJdHS5F0TBoP9G6oNt1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=iaVcoVSi; arc=none smtp.client-ip=91.218.175.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="iaVcoVSi" Message-ID: <0fe2a584-c633-4f82-8c47-d204e3b39a57@linux.dev> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1781773784; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WKrBJr5QmN+p5FbcRlDp75b6qG882022YARGfpuKY7s=; b=iaVcoVSiDIAOGWJUuJNAp8Ahx07xCPBuz/Rn6y8sE6PY32pmlFgooAFFRZJLl1HreGsUMs NHy+Pf3tnl0QlBrwxn7rDoaiYpKoqBh6B6eag51TlKEAddnPbcx/CZr/YSR/arQESvRcdp TertYgNDaOYeIzia/R60F4s2Jttch0U= Date: Thu, 18 Jun 2026 17:09:28 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH v4 02/12] mm/rmap: Add try_to_unmap_hugetlb_one Content-Language: en-US To: "David Hildenbrand (Arm)" , dev.jain@arm.com Cc: akpm@linux-foundation.org, ljs@kernel.org, chrisl@kernel.org, kasong@tencent.com, hughd@google.com, liam@infradead.org, riel@surriel.com, vbabka@kernel.org, harry@kernel.org, jannh@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, rppt@kernel.org, surenb@google.com, mhocko@suse.com, qi.zheng@linux.dev, shakeel.butt@linux.dev, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, shikemeng@huaweicloud.com, nphamcs@gmail.com, bhe@redhat.com, youngjun.park@lge.com, baolin.wang@linux.alibaba.com, pfalcato@suse.de, ryan.roberts@arm.com, anshuman.khandual@arm.com References: <20260618074449.24974-1-lance.yang@linux.dev> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Lance Yang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT On 2026/6/18 15:55, David Hildenbrand (Arm) wrote: >> return __rste_to_pte(pte_val(*ptep)); >> } >> >>>> + VM_WARN_ON(!pte_present(pteval)); >>>> + subpage = folio_page(folio, pte_pfn(pteval) - folio_pfn(folio)); >>> >>> No need for subpages. >> >> So plain ptep_get() can feed raw huge-entry bits into pte_pfn(), and the >> derived subpage can be wrong. > > Good question which impact that might have in practice? The subpage check can warn, but we still pass that subpage to make_hwpoison_entry(). So the hwpoison marker can end up with the wrong PFN? + subpage = folio_page(folio, pte_pfn(pteval) - folio_pfn(folio)); + VM_WARN_ON(folio_page(folio, 0) != subpage); [...] + pteval = swp_entry_to_pte(make_hwpoison_entry(subpage));