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: 184678 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:6f82:b0:100:9c79:88ff with SMTP id tb2csp4911774dyb; Wed, 3 Jan 2024 01:18:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHf+mguV4aMtelPSvrAx4MkhZ+Ri4vltOfrlNNRHqZ99XCATLsWy6Rb9PiAJttuodyEKhnU X-Received: by 2002:a17:902:a387:b0:1d4:ac86:4ccb with SMTP id x7-20020a170902a38700b001d4ac864ccbmr1986886pla.15.1704273483991; Wed, 03 Jan 2024 01:18:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704273483; cv=none; d=google.com; s=arc-20160816; b=xLgzAI2Cww0F/l8VAzSVFy8CdzD2F1JcgdtJufBD4uwgr2yrtisYkhNnWfm4X+EBEu 9yc+ivmlL+XUHNHHJVHvxGL5i6uucpZEtCHTlJCypzCCiUgM7YfJezLNXfUHvUltApEN e9/r+VqVVFdUNd2/xj2jWNJ3noJAbvPfTBTg15uY+wifUTUXr6Ziuelu58qApoWupEhl htU7n2GaHL/YR1Xtiib1FT1+1MCHTswN6+wonj/s82S6ZcDZjbGeC6qYEkjTz02irGJO peT/+fIJEGE2Nb+GlrlY4izr6PurBoIxi5xpZSrE/eu7I945mD2bA1Iek1z2BkfvkPY5 SrSA== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15319-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z20-20020a170902ee1400b001d08c079196si9193557plb.36.2024.01.03.01.18.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 01:18:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15319-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15319-ouuuleilei=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E3A51B233DF for ; Wed, 3 Jan 2024 09:16:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 601D918ED3; Wed, 3 Jan 2024 09:15:40 +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 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787060273050695079 X-GMAIL-MSGID: 1787060273050695079 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<