From patchwork Wed Jan 3 09:14:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13509769 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4A89C3DA6E for ; Wed, 3 Jan 2024 09:16:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 475878D0035; Wed, 3 Jan 2024 04:16:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 414088D0055; Wed, 3 Jan 2024 04:16:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 215748D0035; Wed, 3 Jan 2024 04:16:06 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F05F58D0035 for ; Wed, 3 Jan 2024 04:16:05 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 01BF51A08BF for ; Wed, 3 Jan 2024 09:15:37 +0000 (UTC) X-FDA: 81637441956.17.C2CB7D5 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf22.hostedemail.com (Postfix) with ESMTP id 3EA00C0005 for ; Wed, 3 Jan 2024 09:15:36 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=E1fM4pJc; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf22.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704273336; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=t8fO7lBnC9by3RspplJseWzRvj3+WjzIcx8hEKl7Z7Y=; b=PWbkNJV9sZeOYnElOqefLH7p3qRHxlDb6V8aVq3cs/sf/38qW4Z4rQQZZoBVRj21LRYw4G 0NeEWzn3Q7Mzc7C9lbZK6WID4ymTQQUZr5fWHqdFlZ8n9zoIndIYqMOEgrid0sUt1OP8t7 me00ZSO6PG58RRnQnYboZHb6GcKhWzk= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=E1fM4pJc; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf22.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704273336; a=rsa-sha256; cv=none; b=AdQXfW3K6fP+XMtfqxaevO/8TEzi68fiKWJqX5mpIdVRi+YT4gZFvtFQFyz5XSD76R91wc a2pRtj+a+zEkjTJJvwU8HVlUOpqjB1vuY/vJAI40Ag/MMnZ+HCWlLzTXOH2soMkll/aCqz 7D566L6shOfvI7CEo82UWgyQxsqWp/U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704273335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=t8fO7lBnC9by3RspplJseWzRvj3+WjzIcx8hEKl7Z7Y=; b=E1fM4pJcayThRK6FRpk4M6AoSQQY9YEn8zt79JrRs2PqbOA+GPvspCo8e0dFmfypG+8ALq lccQ/0a3kby1WpWmRJkSO1oE/leKsu3dLXWtYHgvpJmJk+Ljdyp2vD/8PjEGjHSLp5leW5 MFPL//oWJqTNK0KbGI6hC+7u7XaeFbs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-138-l-IHSWebO-mu9VTGyPcb0Q-1; Wed, 03 Jan 2024 04:15:30 -0500 X-MC-Unique: l-IHSWebO-mu9VTGyPcb0Q-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AFB6887DC01; Wed, 3 Jan 2024 09:15:28 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4F290492BE6; Wed, 3 Jan 2024 09:15:16 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: James Houghton , David Hildenbrand , "Kirill A . Shutemov" , Yang Shi , peterx@redhat.com, linux-riscv@lists.infradead.org, Andrew Morton , "Aneesh Kumar K . V" , Rik van Riel , Andrea Arcangeli , Axel Rasmussen , Mike Rapoport , John Hubbard , Vlastimil Babka , Michael Ellerman , Christophe Leroy , Andrew Jones , linuxppc-dev@lists.ozlabs.org, Mike Kravetz , Muchun Song , linux-arm-kernel@lists.infradead.org, Jason Gunthorpe , Christoph Hellwig , Lorenzo Stoakes , Matthew Wilcox Subject: [PATCH v2 04/13] mm: Make HPAGE_PXD_* macros even if !THP Date: Wed, 3 Jan 2024 17:14:14 +0800 Message-ID: <20240103091423.400294-5-peterx@redhat.com> In-Reply-To: <20240103091423.400294-1-peterx@redhat.com> References: <20240103091423.400294-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Rspam-User: X-Stat-Signature: r5akjo1nutnp7x4mo6kxz4s5ebhd34ro X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3EA00C0005 X-HE-Tag: 1704273336-634745 X-HE-Meta: U2FsdGVkX1/Uqz9xy9VoqChCfvS4sgk/bXcgBvCHP4url2NQ5s3bNEGDUIIACWtn/eZcHA9DjngLIwEE1K01jxDnweyos84sj1YzSGcL6/9Y+6CCnZnEWUObWe9gjSVOCyKSXfSTgmXugLRG5B/CtPiiMKyGFGddOEt4wlSkFmDh3cEVzK9rNW8A6Gpez6aC5P0vVuyNmkWEc+rMRJlZrEujj+6aeZIL5QeKpYJ5I2W8an49LxWvqyDp22vURhNTlBavcU4+9joiRgGaLH8+vtTk6SARH18tzy9G7fPP2thTKhGXwFhslTan7WQVeeK0ezOGA0kntCOQOK39NCI9lZq4sroa1OnepkrbtkoJR53rKczoC7AuwsCybDkze3x8p8lCp8zCKMl9k8hYG9i3o+2a0glNT88ZC6RhexaPUU2rkjaWUfwIcFj2lnHkepRLQtmS9wYn/931JtckneNFsPyz6/o9MwLEMCMlHRuhfaehEy8doXla+A3X8rIo3fp1yIxrd9OHZxmltx8q32TfOmk7brbTFUSAKA+CjrpwlySSXouneh+ygWjE5cX1vPIdMk1/8N7aDsPzgYvKxm9Bbj9L1UijQjdtPnsuQ1IZkqdnVM7m7UMM43fgovYNv7bSbfxUEUdhnJvSIErRijHvUIGb/z7bfnyGDeboMGBuB0lCs+AYEddBb/wbEn5L4x0wUguVJGTuY3YiPmwfNb20Jis/dgXdf1WEsOqD8oafeXDrEPGFpZj/88uG8PAtOxCjYaqDD5m3s4C/ys8YkpyTAxt0pfg8/kVv6MyhSB2vcwr89vft2q9dSA/ve5al8H6z3QDJAsmG3/wIK/FV0ACIGoNc4LoxtTolodHMIY3pZldHbgeHvIOmIASWvbooED4avJAC5bGoIy87qfQewrunkXp6EqQFDdrdkVvdAvH2qlpz/Dr+V8CORPB/E31jrAZ8tlhTNxGuHQkPH5D+QTK MuAnI9TF SA69Z4EFvTpfS89UlTK7XmshrU37dPh8DXQeNe7T4E467k0tKzXz8L4B2UvA9F36NFzli+YSAqZ8BCIrpBG2TYuvKsxA1W9SNuPGt96UdEiyWHMY3bJP/q5yTBb2hsDeo8TDzwm+e+pUnQGp46hOwd4ly9NrRVgdwvMiaFKWGW82GN1TUjJaEgcyVzcA2WcdL3ML7q++Lg95305+xLMMFUbQZpKonArD04Gokqz9EMyf0QSwpNr7i0MVhE4hcpVm++gPwSV8AA8cfgmfMyCL09bDXZCMW7oU08Kc5EturMW2bmVRGj6C9vvmFmlhmWOOuDxlE X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Peter Xu These macros can be helpful when we plan to merge hugetlb code into generic code. Move them out and define them even if !THP. We actually already defined HPAGE_PMD_NR for other reasons even if !THP. Reorganize these macros. Reviewed-by: Christoph Hellwig Signed-off-by: Peter Xu Reviewed-by: Jason Gunthorpe --- include/linux/huge_mm.h | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 5adb86af35fc..96bd4b5d027e 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -64,9 +64,6 @@ ssize_t single_hugepage_flag_show(struct kobject *kobj, enum transparent_hugepage_flag flag); extern struct kobj_attribute shmem_enabled_attr; -#define HPAGE_PMD_ORDER (HPAGE_PMD_SHIFT-PAGE_SHIFT) -#define HPAGE_PMD_NR (1<