From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mta0.migadu.com (out-100.mta0.migadu.com [91.218.175.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D78AF48CD49 for ; Thu, 13 Aug 2026 16:10:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786637449; cv=none; b=cMpVxkKChj/Ps04lowcbD6zt4cAYqElew4jVU9xLs1gV0q9qJEMJ0YCjE+ODIkceLkvmUqtsBcZpKl13h562RuBpy1BdPGNa4qFY0GAHTj9/w78KrgP3maJqvM0JYTomwPTdiTgXN8XgNp3f0Dqws+lBoHFhK8G1/JYVF7i10TI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786637449; c=relaxed/simple; bh=fw0pOBNF7/8wD8xBIHeT0X9Z9PJ+9rMt7Vt2Uw6EE9g=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=YE8uZ4HMVaEPoLuTeH02sjqPC5c4WtwBzSSf3YeskEPHJbWdiscpe54R9sirLKXDDolitbpUBjk/q5Zd6pNIDIT3+rk0W7lTHQzUnEmrHsu3Z+ez/V2EQ+BU1RMDPECG4VGWNPjHud7VIl3Mp6La7ki7WVidUY/gqQhTlveAjvQ= 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=PXJUZmtJ; arc=none smtp.client-ip=91.218.175.100 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="PXJUZmtJ" X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=fw0pOBNF7/8wD8xBIHeT0X9Z9PJ+9rMt7Vt2Uw6EE9g=; c=simple/simple; d=linux.dev; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1786637442; v=1; x=1787242242; b=PXJUZmtJRnmTqPXYc8rpD6GhU5eqS3Qk1TsXYGr0IY8aNIhSUFrpS8tRWSigvzbumPWpDcne hIiJLOg3cgSQwXvb7k9NhM6nmc0Fp4nGE3Watzkif+agymK8wATy8zVFbiS90htDEUTDx9ptkNf mMUIuoTjxUcCj4tiCxvhyWro= X-Envelope-To: linux-kernel@vger.kernel.org Received: from localhost (77.97.51.77) by smtp.migadu.com with ESMTPS id 487cbfbea8bd0349; Thu, 13 Aug 2026 16:10:32 +0000 X-Migadu-Flow: FLOW_OUT Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 13 Aug 2026 17:10:26 +0100 Message-Id: Cc: "Borislav Petkov" , "Dave Hansen" , "Peter Zijlstra" , "Andrew Morton" , "David Hildenbrand" , "Vlastimil Babka" , "Wei Xu" , "Johannes Weiner" , "Zi Yan" , "Lorenzo Stoakes" , , , , "Sumit Garg" , "Will Deacon" , , "Kalyazin, Nikita" , , "Itazuri, Takahiro" , "Andy Lutomirski" , "David Kaplan" , "Thomas Gleixner" , "Yosry Ahmed" , "Patrick Bellasi" , "Reiji Watanabe" , "Sean Christopherson" Subject: Re: [PATCH v3 07/26] x86/mm: introduce mm-local region From: "Brendan Jackman" To: "Mike Rapoport" , "Brendan Jackman" X-Mailer: aerc 0.21.0 References: <20260726-page_alloc-unmapped-v3-0-6f5729aa9832@google.com> <20260726-page_alloc-unmapped-v3-7-6f5729aa9832@google.com> In-Reply-To: On Sun Aug 2, 2026 at 5:27 PM BST, Mike Rapoport wrote: ... >> +#if defined(CONFIG_MITIGATION_PAGE_TABLE_ISOLATION) && defined(CONFIG_X= 86_PAE) >> +static inline pmd_t *pgd_to_pmd_walk(pgd_t *pgd, unsigned long va) > > There's very similar mm_find_pmd() in mm/rmap.c and I bet a bunch of othe= r > places walk from PGD to PMD and return PMD in the end. > > Can we put this function into, say, mm/pgtable-generic.c? > Finding all the places that do such walk and sticking it there should not > be a part of this set IMNHO, but having it in the generic code is a good > start for a future cleanup. Yeah, this is the kinda subtlety I always run into when trying to play with pagetable code, and I end up being timid. The thing is that mm_find_pmd() bails when it finds a non-present entry. I think in this case it's fine, so yeah we could at least move mm_find_pmd(), change the mm arg to a pgd_t*, rename it, and call it from here. >> +{ >> + p4d_t *p4d; >> + pud_t *pud; >> + >> + if (pgd->pgd =3D=3D 0) >> + return NULL; >> + >> + p4d =3D p4d_offset(pgd, va); >> + if (p4d_none(*p4d)) >> + return NULL; >> + >> + pud =3D pud_offset(p4d, va); >> + if (pud_none(*pud)) >> + return NULL; >> + >> + return pmd_offset(pud, va); >> +}