From patchwork Tue Dec 19 07:55:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13497940 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 CF857C41535 for ; Tue, 19 Dec 2023 07:56:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6ED6F6B006E; Tue, 19 Dec 2023 02:56:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 69FD46B0074; Tue, 19 Dec 2023 02:56:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5680B6B0075; Tue, 19 Dec 2023 02:56:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 462D46B006E for ; Tue, 19 Dec 2023 02:56:49 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 278511C1416 for ; Tue, 19 Dec 2023 07:56:49 +0000 (UTC) X-FDA: 81582811338.04.7CF5A12 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf28.hostedemail.com (Postfix) with ESMTP id 7462CC001A for ; Tue, 19 Dec 2023 07:56:47 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RnUc6K0c; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf28.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=1702972607; 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=W3mfDaRytJv6LOYv89LHjQVs33fumKlGjLMhNR5CFmw=; b=DpcH2cHh6UDosF1pwTlMivgGLd3zC9Av+7KooJNvXGo+KlCGzFFw2S/c+n/T2tDukYJucD 2nzCjz1OIzCRINA1eRAvQoaTIt7ewUfwJADF9ga4gtz7Td/I9H3BTTi8zszzIeTFB6R0Ot yRuxN02Qf+B2DVUfAmO/eLhVg7iMomM= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=RnUc6K0c; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf28.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=1702972607; a=rsa-sha256; cv=none; b=Di9aFTsm5XJPfbsnej0S0z9qezzoxtVfZHNWsuMHg80i1CwNxJYNClYekjzaaKPp6dZYvJ mmvvLXptaub5t8rkJh29esHJkSYnK6abLg8Kx9VG/YsOluKshFZ3N0nwq1vVhNfsMnkvn/ 43Lpwve9nMeIsm/5vttHreSq6GPLW4A= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702972606; 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=W3mfDaRytJv6LOYv89LHjQVs33fumKlGjLMhNR5CFmw=; b=RnUc6K0cGj0zBJlFV8m63X2HVayTxf1KoVUzY8i3sfBTfS+nyWORM9Yw08juYEf3BHnC0S IPT2fg+b7nF7Ln9GBQwNxfXQ+viavW8W1mAgMPRF6HKQffepGH8VH88ZbRliIIqsv+S/Qg YTE2TygdBkC4ayE8A/4+IDkakGtieWc= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-k0rHzqs9O9yPkXz_rzqp7g-1; Tue, 19 Dec 2023 02:56:41 -0500 X-MC-Unique: k0rHzqs9O9yPkXz_rzqp7g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 0C34B1C0513F; Tue, 19 Dec 2023 07:56:40 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.117]) by smtp.corp.redhat.com (Postfix) with ESMTP id E06102026D66; Tue, 19 Dec 2023 07:56:28 +0000 (UTC) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Matthew Wilcox , Christophe Leroy , Lorenzo Stoakes , David Hildenbrand , Vlastimil Babka , Mike Kravetz , Mike Rapoport , Christoph Hellwig , John Hubbard , Andrew Jones , linux-arm-kernel@lists.infradead.org, Michael Ellerman , "Kirill A . Shutemov" , linuxppc-dev@lists.ozlabs.org, Rik van Riel , linux-riscv@lists.infradead.org, Yang Shi , James Houghton , "Aneesh Kumar K . V" , Andrew Morton , Jason Gunthorpe , Andrea Arcangeli , peterx@redhat.com, Axel Rasmussen Subject: [PATCH 04/13] mm: Make HPAGE_PXD_* macros even if !THP Date: Tue, 19 Dec 2023 15:55:29 +0800 Message-ID: <20231219075538.414708-5-peterx@redhat.com> In-Reply-To: <20231219075538.414708-1-peterx@redhat.com> References: <20231219075538.414708-1-peterx@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 7462CC001A X-Stat-Signature: j61roe96mebh6e3x4krg5xkpftcd317s X-HE-Tag: 1702972607-598398 X-HE-Meta: U2FsdGVkX1+gRUWqNe42Dvsdsnfqz/mccBbzpxW52XNBGXYF8OIUxtMVCj90dl3xGKWqr4+Nzgb9H3VlLwJhsrT1S43RT9AZl20tgw5xZuuEBr8gzho1b5Jve4QuWPxNw1VJpZKR2TPRs4WBCoWlDnVUW+E2JUH8p3bACPIO8KbVNv2eBpXiHkamG/9o5aHjLjFrFzp6cPMJ1wR6TTm1nU004Glb8XU8u3Ah+pHe+ttJJuokqsBitP8bdYn/yQZsJMcV2+ZboWvL6QfQ+zpiD3xvnTfuUmG6QqX2193eEDHpa7ppQVPFsVie84WI5VET+A+OHHYb88tbHU9E+pxUEdBQBpitVy3YdZyVY9wa5HI403p48l+eB236DHsTIZ1slWBjW3utWwMf8Et3nqvV6tjnNMFzOEtWupMpwwAkYYBgKm6BK+HHvnPZAE54uGR4ZTaMFa34vLU0g4v6yqeJr646NqoRwIjPC79uAnu7egYyIi26aBDf80V5hmUN3ksyL7tSdRSsAaOocpDZzCprw1PFlfqEetBQ279iiZrU4DmzoVNOzC5dyQwxqkFSTrbdhus2pw+zz/31qczKVrf0KbcD+qiR+oQSSdteYfbBOsQLBgMofcCTuJlevdnWd7hXLOX72qdG4Or6d0L2dnI2jgEtWqki/yYoAgPVUaKKdP3Xtw6M+INTxMP2824f8eN3hWV/NKp9z14sKarJiCNiVeHwLmWsrUXwdVzmgEZZdp3GlJQ9awMoWsKGaoZST4wu8nYFG1SoyRUwZPOK7SB7bM384IgyfPcDTQs/r7IBjTw66OZTN413lOsXO18gDY6nglYBcAiZJkM7Q5IZEpA2r8Y6cs3Uty7y7dX7Junl6JS2NRMxv8CUwtG3y3jESII/Z9gGjHwIPuIto0iRKJ+gfuN0C4+RbP24AZ/e9Wa/atzYLatFCVlweyOspiKjeZ5a448WWQp7WxpORNlu+kw rniT4VoR UbGqBeJ4uoLUAsfHvIeAwzzFDSX6wp/Lcut9FxRSXh2hPDmtmqwmSGmS2p/P2HnsPJmqFJhT/Rx8pUMgd1B1zMtxUrUT4R3GsKtFewVkPkS5HGyig9bbctTelt6Fd1RrAQa44ZlJPicXTxE0mXybzisSh0nFuG4WVKTl/dSNYaNfogOjv/Y3ogmP8YsR+oUwC/cq2LPa2/GYk8cmMn9LkG5SLWlDi4fLD56RZCp574U/oVuteYQ315CFE49mZqbZVlssY6K7+8jADroFUIDGcLvQ4ImdnAC1tZ9TEqBQMQgsVBiKeuQiypKj1d6nwE2M15u+x 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 --- 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 fa7a38a30fc6..d335130e145f 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<