Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7013574rdb; Wed, 3 Jan 2024 01:16:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGr2ztSZC7Y7d8OksMCbAOEW/dHsxbQssfWHM/bWB7858vm5gho8FW+t9WKLY2zFekSaqGJ X-Received: by 2002:a37:c405:0:b0:781:551a:a53e with SMTP id d5-20020a37c405000000b00781551aa53emr12986265qki.73.1704273399591; Wed, 03 Jan 2024 01:16:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704273399; cv=none; d=google.com; s=arc-20160816; b=E588xlxgIAGaYiribp5tXZ6QQIf1qotF+p7gjT9nxWyniqrEzNhsvGrk6jcQdSjrbC u/EW5my/GklMAkZmLpLOWTTp3C3VloW2qr+hdzbD3CZhk0nQxSp5HXSOgf1RZSQwlu3O aPyZ2hHR22T/IBk3k9s8dhFU2FiQkTaI1XcfBCOuP7rYC6Mr0BcL7gzj8NjGYBGlO2Vq pOMXzUepUi4E1KTlAezK4dYO91e4draccVMU+z268jf+hLDnQb2J1Fa6XI+mTfE+rkhM 1sHcY5lNy9Xpsz7Jv7GJ2pw6zDCoRjGT1yfeW33UoNAiu0hRL37zWfz3OwJshAyM+daZ qxGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=t8fO7lBnC9by3RspplJseWzRvj3+WjzIcx8hEKl7Z7Y=; fh=JvQ3nGflNTIwPBfhSW2OJAIjHOHR+R1SiFkwzYoQoWY=; b=RC5nBfP/2aJgcRIbwkEuFTNIqffPTjI6kWEXsHF63Y2xoBljQQHalJl9nTvctFxvzb Z/LxyhukcIdvG8J+jq3YXKTs+nxWZMqvsj0hktaayM1LN6iyeH9pLCDd5eTQqXvSSNmU od8lFP/qzJM326EYonhNcG1bZjKvwDeXaMb/6k6x4XtN3Y1lhVNG7lx0IcvFHcjHluPk kgukAvS3my8IEpNkoOZ362UJpQhSDBrG2XiGUIGoOD604cG3ttQo6iCmweVHy3XuFLi3 umBE+A0p36cPwfmfZFHc0Rk7HlzeQywyG+JF70ohfJZq7juUf49HXM0kd8uEo5iWi546 rSiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E1fM4pJc; spf=pass (google.com: domain of linux-kernel+bounces-15319-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id m5-20020a05620a24c500b00781eb526543si123258qkn.581.2024.01.03.01.16.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 01:16:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15319-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=E1fM4pJc; spf=pass (google.com: domain of linux-kernel+bounces-15319-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15319-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 59E281C2312E for ; Wed, 3 Jan 2024 09:16:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 965FC18EAF; Wed, 3 Jan 2024 09:15:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="E1fM4pJc" X-Original-To: linux-kernel@vger.kernel.org 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 66D9B18EA7 for ; Wed, 3 Jan 2024 09:15:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 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 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<