From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 49A0D30DD0E for ; Mon, 17 Nov 2025 19:15:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763406950; cv=none; b=ouISUVZ7zE9evrOphChVGmUpJHUknPDbE3PII2ZgjDXkpme552tQKCWfNJ854CLihPzYJ7AU3GxIntIR5ejUtOqgQ074RboyDueEf9mzZJH6Xen2+NDic+V4v11rYy8vZyB3zauLwKk2A2eH5GxR7yJw3bI8eFHjryRqaejEPqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763406950; c=relaxed/simple; bh=STgIZmNIw+sz4bdTxnpM9tP/kT97BHvCDqyCUO7k0ks=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=ARaQUEtlLCkaLYLUeAqKYVIA7SxRbGnWD4jp/ScGcBKFLzJGig86LbtC1KC4Qzl4CEj6LXsdA3Uydfx8mfi2G0qW6eqK8UHohiFjK5eziW5Q38V7VLzA8DcZ4IzokP9LJL3kqICIiujRRPr9gnPMrVRnXawrkfiEwTeL44ggtaY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=KFnY8QGn; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="KFnY8QGn" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1763406947; 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=VgXj9j8UIpfH8qRYNNbd8ocQ5iSZL8eoT+nYWqQuZVE=; b=KFnY8QGnZKY5GpBYCAh4C/QoOLLZELrjGQoAyKAJecnNlkFW9RzFgWNFx5llyJXZYNE1Sa 80I8I0sCq2Be7Bbrm/3UOGyW+qN6kq2Crmzhiuk2J0VfrsYCn0kAoYGAHez54rA0DuNdwN hUoFL3TUy4c8VHYFkgfyagFhQWS041M= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-180-epQ_vFt0PXeRKnjrB41dbQ-1; Mon, 17 Nov 2025 14:15:45 -0500 X-MC-Unique: epQ_vFt0PXeRKnjrB41dbQ-1 X-Mimecast-MFC-AGG-ID: epQ_vFt0PXeRKnjrB41dbQ_1763406945 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-8b2ea3d12fcso459408685a.0 for ; Mon, 17 Nov 2025 11:15:45 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763406945; x=1764011745; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=VgXj9j8UIpfH8qRYNNbd8ocQ5iSZL8eoT+nYWqQuZVE=; b=XahvxNRdUZOO+rDRZ+2LM15RgwzWaLcBQRDcBBsg9HFJfXbFung3Xcmxp9+gYJGL+B nS7HcK9/q1n4P8JoY54HVfLGtYcVjtG3CgqRTnPWnZf1zdqeH6QSNVNyLD24eEr3Gkxq 3cl6Ts0dgYN1Dbj6tEf6FrOE4gCE66xcolR1lsPK7592IIS/fTP8yHRiGQ0ZJ5fyFM6u A5agB0SmyI4z5/xSFEgIKXr042qkJPKC0KvBE0xOzXMTW9qMKXucOdKOtCZ8sI2gKXom yQlKwn3RMb+fvRhYJu59JEV0zoByULaj2yxPxYZ/mbSb4QkerweZ5QJetTxfH6KIvCkO 8oCw== X-Forwarded-Encrypted: i=1; AJvYcCU26uH0ZiOFYudng+wmeLJJ1jZ/YeTCnhG+rlz0/eLm2ea8Z1nJ1rOm60TJmjQvbG3QZn0ic54VqVYjwcc=@vger.kernel.org X-Gm-Message-State: AOJu0Yyhts14HDhtVJUwKMFz8dGJ6wr2aU3bpUyEFCrsoD5IjZX5oIZG rhig+7YkHWlRSz4q7pORhUpYbuHqE6cMMuQ5mdUKG/elVpYnnvPLAdkqzEi9BjViJ1RFv1meAyN YTyNcZ8VMmKtnb3QsKVgKb7AVCW73A2qbIg63WCBMwUAmuVy24d7NqsQN+LEzHQf8Rg== X-Gm-Gg: ASbGnct+nRqFn7cedmMs52nX5BOrhVkpyc2HSjIgXBi0qHpIs6MSQw/86qshZhBQ7iu EldjeZIS6u/NfgJq570T+QhVqLtdsEVCD8oFrZnHm9tr69Ob0ahTanREqgmXgS55ha9s7M5DB/1 fK1ym55HPio1Yg6x/oW5HVlGzvYGLV6mPjzIly/hVxj61Jo63+v7CxZVUfer/2KMJfAciASkpkm HERVrbb64nVzRTssAJFBh4xBuwLeOrzTVsFdN9zsYgMS93ZmZohNpCNQab5MRCW3+4RO1kJ00xE IZ8/KttGYb+NVGX4FPSGmi90+s5V6jatT2Dgef2lE80O/oDcAPxG9MtdNpOMmA9uDrkUpdTRjpu mT/MdVQ8U48g= X-Received: by 2002:a05:620a:4708:b0:8b2:f31f:ae18 with SMTP id af79cd13be357-8b2f31fb082mr429791785a.34.1763406945085; Mon, 17 Nov 2025 11:15:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IEqsiIgJU6/qZqFx0ELIF8xrwp5k3EMVSYp5628XWNgHz3g2dIiOlJwNHDX+EKM6sNAUe91Lg== X-Received: by 2002:a05:620a:4708:b0:8b2:f31f:ae18 with SMTP id af79cd13be357-8b2f31fb082mr429786685a.34.1763406944538; Mon, 17 Nov 2025 11:15:44 -0800 (PST) Received: from [192.168.2.110] ([76.65.77.217]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8b2e519bb84sm476682585a.34.2025.11.17.11.15.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Nov 2025 11:15:44 -0800 (PST) Message-ID: Date: Mon, 17 Nov 2025 14:15:41 -0500 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: [RFC 10/10] mm: thp: x86: cleanup PSE feature bit usage To: "David Hildenbrand (Red Hat)" , linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: ryan.roberts@arm.com, akpm@linux-foundation.org, lorenzo.stoakes@oracle.com References: <8dc0695aa1c1073ec475be18e300ec1046344e84.1762464515.git.luizcap@redhat.com> <58caeb32-f50a-4056-828a-476d958955ad@kernel.org> Content-Language: en-US, en-CA From: Luiz Capitulino In-Reply-To: <58caeb32-f50a-4056-828a-476d958955ad@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2025-11-17 12:49, David Hildenbrand (Red Hat) wrote: > On 06.11.25 22:28, Luiz Capitulino wrote: >> Historically, THP support on x86 checked the PSE feature bit to enable >> THP. On 64-bit, this check is redundant since PSE is always enabled by >> default for compatibility. On 32-bit, PSE enables 4MB page support and > > Or 2MB support with 4byte PTEs I guess? > >> must be checked. To clean this up, this commit: >> > > Likely the subject should start with: "x86/mm:" You're right on both points. I'll fix the changelog for the next version. > > >> 1. Drops arch_has_pmd_leaves() from common x86 code. For 64-bit, >> we assume PMD-sized pages are always supported >> >> 2. Checks for PSE only on 32-bit, using arch_has_pmd_leaves() >> >> Signed-off-by: Luiz Capitulino >> --- >> arch/x86/include/asm/pgtable.h | 6 ------ >> arch/x86/include/asm/pgtable_32.h | 6 ++++++ >> 2 files changed, 6 insertions(+), 6 deletions(-) >> >> diff --git a/arch/x86/include/asm/pgtable.h b/arch/x86/include/asm/pgtable.h >> index 08d109280e36..55b88de5178f 100644 >> --- a/arch/x86/include/asm/pgtable.h >> +++ b/arch/x86/include/asm/pgtable.h >> @@ -313,12 +313,6 @@ static inline int pud_trans_huge(pud_t pud) >> } >> #endif >> -#define arch_has_pmd_leaves arch_has_pmd_leaves >> -static inline int arch_has_pmd_leaves(void) >> -{ >> - return boot_cpu_has(X86_FEATURE_PSE); >> -} >> - >> #ifdef CONFIG_ARCH_SUPPORTS_PMD_PFNMAP >> static inline bool pmd_special(pmd_t pmd) >> { >> diff --git a/arch/x86/include/asm/pgtable_32.h b/arch/x86/include/asm/pgtable_32.h >> index b612cc57a4d3..3bd51cfa431e 100644 >> --- a/arch/x86/include/asm/pgtable_32.h >> +++ b/arch/x86/include/asm/pgtable_32.h >> @@ -45,6 +45,12 @@ do { \ >> flush_tlb_one_kernel((vaddr)); \ >> } while (0) >> +#define arch_has_pmd_leaves arch_has_pmd_leaves >> +static inline int arch_has_pmd_leaves(void) >> +{ >> + return boot_cpu_has(X86_FEATURE_PSE); >> +} >> + >> #endif /* !__ASSEMBLER__ */ >> /* > > Right, IIUC 64bit should neve rrequire this check. >