From nobody Fri Apr 3 09:28:54 2026 Received: from mail-oo1-f42.google.com (mail-oo1-f42.google.com [209.85.161.42]) (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 AE73426E706 for ; Thu, 19 Feb 2026 02:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771466654; cv=none; b=VdZrfCOLdEj+PR5a48MmNYDvXqUMkEn5wik3PIc9PfyVn1o31u/PZ2EVHyoKGn4YUzrrsTHXNEciieJmd78LVNrNlXpcnFMM3bucVCqOO+6cyxPqajkHbewnJM2L1VV6U48Xf9kQxp0+adCVRDK5jL5NR/bn+RFsZUZCz8e8Pno= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1771466654; c=relaxed/simple; bh=oNN3M+Li/7uEHsL3+e6WkBKtDRwSokzGuiuhUCjEkDU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EA82OyB410vPGD7WBeLkjD3QyVkIUa9Qd8XPLOW+fxlVko0wlS8Fv9R8HcU8fSbktBxhHCrOjYD1CF1kF3y5BmY2aVwhFOiockWAMaOQLAi42xJY1Nm4mOBiK7aIIb4otPm/E1z1HsyZlRj7jZQsUGrbX760Ab447+Wstz4cS9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Ivb3EK3B; arc=none smtp.client-ip=209.85.161.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Ivb3EK3B" Received: by mail-oo1-f42.google.com with SMTP id 006d021491bc7-662f9aeb765so181254eaf.3 for ; Wed, 18 Feb 2026 18:04:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1771466652; x=1772071452; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nHBv8qiAqn9zn5/9Lglf+QJsgs0ZODCHP/HKhTXpHe4=; b=Ivb3EK3BxYbwaUWoGIFdSzIlrHlvmnR2wtlnfhJSoHXdswixA/AkHU1yNSwd/o7qN1 wMTqQZT8gircshrIWEZ4lzeQYwTqOjZydwXf2Uu+hczx+rNy8FQiZQ9d1p8/2u488qKQ HiOagVxaWMQ+/gdTutEjOWr42zaxsb0InKHzGh2dYjixrIS7CtAQmUhi3sz3zTv+gfXz ElybEsssz5GUThQS2PBIHgcId6fRFBN0PM99mb323i7tUldE4qzc9IzKnsLG7gcCK6bw DVPfUIBszQkExMqLk+hx+FqwbORtee2ay++SGIpZlljz7wYMNOBM1BDp9YLQJfjtYmfn mj6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1771466652; x=1772071452; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=nHBv8qiAqn9zn5/9Lglf+QJsgs0ZODCHP/HKhTXpHe4=; b=sRTCKbJ6s0rO1zzX4AfxH2m8rUk5rKdjm76uHNQB8C4mroqsgxW6WCsrKEbZfEGjmu xVgm8SSuIyjj//KZY7I8zqykJZ3ZikgETGCyYQfDj60VL52qE7+/a/LElqiVKPJwI4Ip 9wsBfHi01yqVkfLCbNGYP4xh9n1vPjbvgCBoAwdn1s9uAGcNlEVKpBLrU1/MjpIFFova CPm9z2bWqZSKsVO+yEyh991KzG2r8H06ODWmTQhoWK6eoHz09dq1S31xaSWxeHypfESP BFcFboG+xdYM8e9SYIa6mYEEDAREbuR+PGsHAFKHSfHJQgnDVEibNRWdxvAfgN2IFZkl yC8g== X-Gm-Message-State: AOJu0YzFwG5wmiZw3RkvnN3FpNzZtFO5z3C4gS7JA0b++MJ+fHtZKDVR FHtsXdFGE3pk/F0Mqg9ZqpoqQPcQ+e2k7BctPy8BpGuR8BhFKIr8KWR8dVtOWw== X-Gm-Gg: AZuq6aJBt0aCfxzZGmhbJ5sS4tEETAC2Vyouqr3BiPAAabQHd8rPwpshQdiuDUzlwK0 xstk9Dm8mhiUGy2atLjIUsHcNA8S3O0B6et822W5144NYKiSze//kR8Aka1ncWyZhv/fXLKbaoN HBUjLuLzEj1Age3yXu/LzICaERtP71iV5mJbqG1rdGA4rgUWSykjAA6JkFlnacvBGhkNIS7JdZA d7udAqedun7kOabfwvm9qEc7StPhNAWy2OochcbpKREbIaqMxLcoVa5FKMiHlOR6lX3DWwLwxxM bx0QtIF2l4SdZ1Rr/fmLO/5fV9ySl25LhHNDIpgpWy39LhYxmnGAU78gpnVpk8BjdhLS6NFaJXM I/iF78y2q1U/ic7aw7cYKrfpEr+COVTOA7fi71UVbx6bO3ocX1RkTjVUQ/XT02f82r1w6SPXBko cwkAy+PE6Xz3jlohGC/gSTzQejHWAGQnUcuyIAEGh9NzaqVWkYMI9srTg/gZKijmgot6+6CDgqI sJUgz/W1ZANbrOI221ibVkljHYOR2imUKOWnyw= X-Received: by 2002:a05:6820:1c8f:b0:679:5f79:91dd with SMTP id 006d021491bc7-6795f799aefmr7884557eaf.60.1771466652087; Wed, 18 Feb 2026 18:04:12 -0800 (PST) Received: from syn-2603-8080-10f0-ab80-0000-0000-0000-1382.res6.spectrum.com ([2603:8080:10f0:ab80::1382]) by smtp.googlemail.com with ESMTPSA id 006d021491bc7-676e3b52902sm12187297eaf.11.2026.02.18.18.04.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Feb 2026 18:04:11 -0800 (PST) From: "Vishal Moola (Oracle)" To: linux-kernel@vger.kernel.org, linux-mm@kvack.org, x86@kernel.org, "Mike Rapoport (Microsoft)" , "Dave Hansen" Cc: "Matthew Wilcox (Oracle)" , akpm@linux-foundation.org, Andy Lutomirski , Peter Zijlstra , "Vishal Moola (Oracle)" Subject: [PATCH v6 2/4] x86/mm/pat: Convert pmd code to use page table apis Date: Wed, 18 Feb 2026 18:03:52 -0800 Message-ID: <20260219020354.321088-3-vishal.moola@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260219020354.321088-1-vishal.moola@gmail.com> References: <20260219020354.321088-1-vishal.moola@gmail.com> 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" We need all allocation and free sites to use the ptdesc APIs in order to allocate them separately from regular pages. Convert the pmd allocation/free sites to use the generic page table apis, since those use ptdescs already. Pass through init_mm since these are kernel page tables, pmd_alloc_one() needs it to identify kernel page tables. Also, the generic implementation doesn't use the second argument. Pass it a placeholder so we don't have to reimplement it or risk breaking other architectures. Signed-off-by: Vishal Moola (Oracle) --- arch/x86/mm/pat/set_memory.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/arch/x86/mm/pat/set_memory.c b/arch/x86/mm/pat/set_memory.c index d52010fd3023..655bef618ea0 100644 --- a/arch/x86/mm/pat/set_memory.c +++ b/arch/x86/mm/pat/set_memory.c @@ -1420,7 +1420,7 @@ static bool try_to_free_pmd_page(pmd_t *pmd) if (!pmd_none(pmd[i])) return false; =20 - free_page((unsigned long)pmd); + pmd_free(&init_mm, pmd); return true; } =20 @@ -1549,7 +1549,10 @@ static int alloc_pte_page(pmd_t *pmd) =20 static int alloc_pmd_page(pud_t *pud) { - pmd_t *pmd =3D (pmd_t *)get_zeroed_page(GFP_KERNEL); + /* The generic implementation of pmd_alloc_one() doesn't use + * the second argument. Pass it 0 as a placeholder. + */ + pmd_t *pmd =3D pmd_alloc_one(&init_mm, 0); if (!pmd) return -1; =20 --=20 2.53.0