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: 180802 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1778445dyi; Mon, 18 Dec 2023 23:57:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEymgYisl0A9Woi0B3JNe1W2ybckSPYkMNVzRB9JiVn4hytAq0gd6IhwRDFsO1twfRKFB4g X-Received: by 2002:a05:620a:ecf:b0:77f:23e:4405 with SMTP id x15-20020a05620a0ecf00b0077f023e4405mr17165100qkm.62.1702972638550; Mon, 18 Dec 2023 23:57:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702972638; cv=none; d=google.com; s=arc-20160816; b=uSXXmrVrruhTMP0woTEi0rFsi4uJhaW3w2fYfTkd4ccxWkLb6I6iCS4ja5lmKW3IBY ueStzPCJoZ1VF+htoVqFLoEqiKZnCumn4C9EihH+IGo080s0qsl8rpaLuqjSrQa0DPGB 1uTyTMZk3r3MAiEfPBM19/9UorlwYsOIppdVPmDYTscqW3Wzvhb4o+LixWBYqMZPcDq1 hHyGo4Bm4lpNX/+LKhD3A3WJY/xYw2BFmCK4TDf64ZKi7v4f7qafdJZJdKYzaKixZthe Qqkrc8e5CA1EfGZRKvleocWx6fp4kNITl6sftO4VRwf9QdCLirUYxxDKjW79fkkafFY3 gKWA== 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=W3mfDaRytJv6LOYv89LHjQVs33fumKlGjLMhNR5CFmw=; fh=3mpu6Yyr5hMzDKtkQvzcApl7ZSQGU4G8QyIY2BAU7VY=; b=out1xCweo97M2znSw4vfEA+8JLKGdsG93l3KW7oh0OaPDcm4tMYPaYR/QKZj5r7IzO fZQdsHeB94fCzVBsyCOHO8ae/LeP9owkgJex4Ezomn/PNrsZs8xNZqJinW6ms/grMLVj 40AdzlMHcY2vZve2CQTFm/F4C6uJfh1YGcono/7EdxOd8RNZqpqoH1OJ4rYkT9+7N1Ak PydwPiOmD/saKO2UR/o3h8UiM7WWtjpbf70OVH9sSypzYsb3OEN8JeEQL9nHnV9hcfTg U8uKS/gI2vdkiQ1u3JMaCTFavKfITDWLxT8OyVdBuA9P1AqEurk7uZee4dqAiRIUIwh2 rz8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="TwZnA+/P"; spf=pass (google.com: domain of linux-kernel+bounces-4837-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4837-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d18-20020a05620a241200b0077bcd1f26a0si27164185qkn.163.2023.12.18.23.57.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 23:57:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4837-ouuuleilei=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="TwZnA+/P"; spf=pass (google.com: domain of linux-kernel+bounces-4837-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4837-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 57D931C236EB for ; Tue, 19 Dec 2023 07:57:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1466B15EBF; Tue, 19 Dec 2023 07:56:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TwZnA+/P" 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 B37EA154A2 for ; Tue, 19 Dec 2023 07:56:49 +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=1702972608; 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=TwZnA+/POS/8p5MX8b8NuTCJRqef+OuEAkm9Sk73SpR4gW4vspKqYa5kSMsZg7kIUWYIyf hChUrNjx6t0+VlEO/xlvuGvZM/HfzC+F0bXtCcVfxyO/yYb9gIeogwfxGKhpzlP3kjfd0C 1T5eRdIREvZQhjDxnzzBz0ca8pmgQFc= 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> 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.4 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785696237423617918 X-GMAIL-MSGID: 1785696237423617918 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<