From patchwork Tue Dec 5 03:05:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 173710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3184009vqy; Mon, 4 Dec 2023 19:06:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IGRY+TFIqNgc6lHRf2GJMS3P/jjWzzEk8zkeAWHCqnEaAVtgi03PG9IGaDGR13oqTOLp36J X-Received: by 2002:a17:903:41d1:b0:1d0:a9fa:58ec with SMTP id u17-20020a17090341d100b001d0a9fa58ecmr2022889ple.112.1701745573395; Mon, 04 Dec 2023 19:06:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701745573; cv=none; d=google.com; s=arc-20160816; b=tM9bQaGMLuDU6eE+NWahjk2v8rW9JWIG6+OWa7YOp2PT6ZoEkKq/RWFUi7VIrG1f2f UM63pMTeldMVpZlGvaA+e6W4L7U6gWq3eUuDIUmt0N2WVc/8uIuyYDdwy3llXMV2+7f7 IeHnrUJEdgJ+4qB4hsgV5X5caQkKLFx4LoYVwDHBh4qQN8NwvM7mRUJbza/kH/KDkUgg saRjqrhXJGCJ8rChoJtoeFO8KqTl/7BLp/mYFa1yBLQ/MPriieHPfPF3N4J0jLO4OxaV ECMgVSlKSpNOYwO161jIv3ZIjUHRIf700f4zzP41MmNwl0fNqnXWMC1ZRoYsLzBkjRWp HKQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=jzYDmmhRG2n20WSmvmn2jO+KOPCtoJ3u06D8mep65Xg=; fh=UHevQD8g/ASKsyBf3gegCtnBBR+hA6VRMUG2agRDexA=; b=r607UFzcrnlOfWxY3GtY0AfUEuzLkDvBjKSyyK6cR7OdL0VRty8jn4UM2BLFV520ax M621TQGgBgz0uVW3Px3TIOuSbPk8oOEaZ9dNrS+sBrVKHpmeHyrHJoV/qXkvwdDViEy4 HswK5BITZ1QOlYbYst04WIjKyAra3qhMNsvYPZniBjvVRU7tPSfLfECs3mTVLNLUBv3Y qw3Z+hRUvGSjv5lC7LX5PZjnzI23SJlZLd7nuuyqcjAWT2ZR7uKnL44C4HTD8vnhYmP/ uqKsbq/QJG59+JJy+JpqSu3LPyBIbWtG+xc5piuuce36X3cVsTVfoowsfAr2ZCwheQAd 6Y1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=kQg3buZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id ij7-20020a170902ab4700b001d0ad56d893si2226639plb.473.2023.12.04.19.06.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 19:06:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=kQg3buZv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 65DEA8042C11; Mon, 4 Dec 2023 19:06:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344165AbjLEDFz (ORCPT + 99 others); Mon, 4 Dec 2023 22:05:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344112AbjLEDFw (ORCPT ); Mon, 4 Dec 2023 22:05:52 -0500 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89543BF for ; Mon, 4 Dec 2023 19:05:58 -0800 (PST) Received: by mail-oi1-x231.google.com with SMTP id 5614622812f47-3b9b8522d91so844283b6e.0 for ; Mon, 04 Dec 2023 19:05:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1701745558; x=1702350358; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=jzYDmmhRG2n20WSmvmn2jO+KOPCtoJ3u06D8mep65Xg=; b=kQg3buZvZ6F4/DpJAKZWwepxnSOd63RTxKqTyubgcJ2C6sRD36IVtMaAMyyiyXgI3n CwbjMzfJOuyuMRnSlpnpt8YBvQNIEPdCtEUNHyFG3w+MP2JwTowTzR/6KkXg7FW3m78d pYpAZQs+jOfTVOdx+yHwS/wqpU5Rinpo2TvF+n1klPzY+BLXxrWLC39H6aZuW4PH3FpG FJ27ihgtu3Hclqqluo9svJR+twpJN9OqpXWz+GM96bDGobHzl14YcRF8aetB1XWZOzUt rzJ5BUPZ18i5gdvgTwOIQwOsElshi6Zayp/Tr7m4kxoYUHFR3518th5wqG3Dz0F5Pf/L jE3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701745558; x=1702350358; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=jzYDmmhRG2n20WSmvmn2jO+KOPCtoJ3u06D8mep65Xg=; b=n4waV/jzULCilWbVeg++B5FgZxYsH+Blihg3puDz/lzGJ2dLhxTaBVp3mS76J0cZvI tUHQ+1nZNqkRCJpuZL4hBetBQ3iJL2K73j6j5OXGvyZjdCzGP4atCV+8kNoRYP+ywQFq 5akPmhHsqh1TDNpjgRzA2QfY38CJ0Xbs9HY8uzwrdCdckpbWnGovaEjd7vhEcNYwfmBA Rv1BJdzqwFOY5hSza9CfBZ7w320QSvy15yD6uK8RrVkZILajS4XswJh0LISLwR7DMMJT YQf6YUH9EEdNOZOgfxTTv7wPpiEgU/DxrLAAzIUteL54xFrKaFNuvR8rm0l/r+Cdh5A2 skEg== X-Gm-Message-State: AOJu0Yx4zY/5RlR2934s1HpuFtp5iV9LHHoeL8PrC69siquTRO5poCdL T+0dViLT1jQQF3pIKOklj5gTY/aYDy1o0fd/QIR7XHDm X-Received: by 2002:a05:6808:23cb:b0:3b8:b063:6b90 with SMTP id bq11-20020a05680823cb00b003b8b0636b90mr6290092oib.63.1701745557781; Mon, 04 Dec 2023 19:05:57 -0800 (PST) Received: from PXLDJ45XCM.bytedance.net ([61.213.176.12]) by smtp.gmail.com with ESMTPSA id ff22-20020a056a002f5600b006cbafa4b426sm92435pfb.110.2023.12.04.19.05.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 04 Dec 2023 19:05:56 -0800 (PST) From: Muchun Song To: mike.kravetz@oracle.com, muchun.song@linux.dev, akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song Subject: [PATCH] mm: hugetlb_vmemmap: add check of CONFIG_MEMORY_HOTPLUG back Date: Tue, 5 Dec 2023 11:05:30 +0800 Message-Id: <20231205030530.3802-1-songmuchun@bytedance.com> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 19:06:11 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784409565870391748 X-GMAIL-MSGID: 1784409565870391748 The compiler will optimize the code as much as possible if we add the check of CONFIG_MEMORY_HOTPLUG back. Signed-off-by: Muchun Song --- mm/hugetlb_vmemmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c index eb05596662d42..be1586a114ce1 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -119,7 +119,7 @@ static int vmemmap_pmd_entry(pmd_t *pmd, unsigned long addr, * +--+ | | * +------------------------+ */ - if (unlikely(!vmemmap_walk->nr_walked)) { + if (IS_ENABLED(CONFIG_MEMORY_HOTPLUG) && unlikely(!vmemmap_walk->nr_walked)) { struct page *page = head ? head + pte_index(addr) : pte_page(ptep_get(pte_offset_kernel(pmd, addr)));