From patchwork Tue Jun 28 09:22:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muchun Song X-Patchwork-Id: 12897956 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 BA86EC433EF for ; Tue, 28 Jun 2022 09:24:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 612AC8E000C; Tue, 28 Jun 2022 05:24:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 54D168E0001; Tue, 28 Jun 2022 05:24:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C7498E000C; Tue, 28 Jun 2022 05:24:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 2A2318E0001 for ; Tue, 28 Jun 2022 05:24:24 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EAD2232E5D for ; Tue, 28 Jun 2022 09:24:23 +0000 (UTC) X-FDA: 79627108806.12.E94A9F3 Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by imf07.hostedemail.com (Postfix) with ESMTP id 4C85C4009C for ; Tue, 28 Jun 2022 09:24:23 +0000 (UTC) Received: by mail-pf1-f170.google.com with SMTP id c205so11464090pfc.7 for ; Tue, 28 Jun 2022 02:24:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HfUjscIbkwVw1h7ZbqwVjjayoThyClFWWQF+WJosK0o=; b=EGLNwsQDxvaVFN8CeCrbJ+70RIMc1tVatGf97UIdEN2EjTlJem9LBckUcEMvfqNlNn QGlqj+u8qVtZY5bvtBdftuNbfM+nkNAiZ+z63aQLD1IPYmC7kZjnEx6Y96sBnJQTqgfE aDqtY2LDm5s0vnLK8DhThwZa+wTWmEeXEARzvdSaqFMJuZOTHDxOpuoomdW+9+Y05jFP pDgrstcy/ouAFxG6blugqbvAgAlXSMCogjLDL6nCoX+je4tqT0xKRdBeC3SiiE/52zZO sJRGwT+879wpDjsISVao7aJixX0Tq3Aqa7e5AQY/zx/IxtCOaa9vVafDm45setubdPOx 0MbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HfUjscIbkwVw1h7ZbqwVjjayoThyClFWWQF+WJosK0o=; b=3PSHU43zlga6pzjR1enh8D7H+WqZcm3lJlT6yVRsejwMoBv246jmZkaOa+2Oa6QQtV fmgBMcmjmccVdbMmqDkTOwA/vUq9qx2GuxG5HILi58s9Kuoeh63ESOqQttSKHI6i8qx1 Ke/1Hvm/so6BWPZ/V85AzbvFDitPG//QNiQfgnLhdSd9QWvWcuHg2Ie1jsaeb5JxMir9 PcvjPD9tyl+gTxJUQWfIzV5SdXisGX68lAifokih4kN7/5FpqdIHz/8NYrS/wftwE13H 00oGISf+EysHM6v1odMIkBXIX0MJDNT8jTnyHakZNffPu8f/g4eS7OXXFDMphHfLclHi 4Qfg== X-Gm-Message-State: AJIora+fi94CNbq3OScBl6SSnEUxfkmVm1D7FiQP3IEnZZkvgeAd4OMg C1DZ866CoR9knRK/Ba3lmS6avw== X-Google-Smtp-Source: AGRyM1t2iPDeZtckQmi9/trLyiw6ixc7ucyEJw2PH0844IZPGmE/175fmI1VMaPArEBzl2GddFK1xg== X-Received: by 2002:a63:6a85:0:b0:3fa:722a:fbdc with SMTP id f127-20020a636a85000000b003fa722afbdcmr17032017pgc.174.1656408262357; Tue, 28 Jun 2022 02:24:22 -0700 (PDT) Received: from FVFYT0MHHV2J.bytedance.net ([139.177.225.245]) by smtp.gmail.com with ESMTPSA id mm9-20020a17090b358900b001ec729d4f08sm8780463pjb.54.2022.06.28.02.24.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jun 2022 02:24:22 -0700 (PDT) From: Muchun Song To: mike.kravetz@oracle.com, david@redhat.com, akpm@linux-foundation.org, corbet@lwn.net Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, duanxiongchun@bytedance.com, Muchun Song Subject: [PATCH v2 8/8] mm: hugetlb_vmemmap: use PTRS_PER_PTE instead of PMD_SIZE / PAGE_SIZE Date: Tue, 28 Jun 2022 17:22:35 +0800 Message-Id: <20220628092235.91270-9-songmuchun@bytedance.com> X-Mailer: git-send-email 2.32.1 (Apple Git-133) In-Reply-To: <20220628092235.91270-1-songmuchun@bytedance.com> References: <20220628092235.91270-1-songmuchun@bytedance.com> MIME-Version: 1.0 ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=EGLNwsQD; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf07.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656408263; a=rsa-sha256; cv=none; b=WxUfFZXN0aqahwrywOlxU4TTaQaCcGESXNjjTArTIgneTVBg/l/GkOswFbTaIurnuz7z4s K8HFtL+G6EI2W/JTWIE91oM/BoXhdwY10sv0LEbGA+Pbefffkhdvm/0UrBb76qaVD85InB +9SRKwW0GTaBEcxwx5kXMXUiNGTq6xc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656408263; 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=HfUjscIbkwVw1h7ZbqwVjjayoThyClFWWQF+WJosK0o=; b=m/sViS17Xp3mGa+glEGo+I43c81o4klN3dCpw5mK9xbtB2C/nt6YkLh9JK8iXaS8JDnsV2 VEvWhlDAKEAa0ZpuUn7/5aqBazFOsFBlWsRjqUzj+K6DP8ZD5bJCRiMcJ78qJDsNJ+HbrX IIGEiPmfaGvDEI14HpCLMr9m0kdvE94= X-Stat-Signature: 45szfsqhusgpdeu88jwx3umnnggqzmhs X-Rspamd-Server: rspam08 X-Rspam-User: X-Rspamd-Queue-Id: 4C85C4009C Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=EGLNwsQD; dmarc=pass (policy=none) header.from=bytedance.com; spf=pass (imf07.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.210.170 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com X-HE-Tag: 1656408263-7522 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: There is already a macro PTRS_PER_PTE to represent the number of page table entries, just use it. Signed-off-by: Muchun Song Reviewed-by: Mike Kravetz --- 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 6bbc445b1a66..65b527e1799c 100644 --- a/mm/hugetlb_vmemmap.c +++ b/mm/hugetlb_vmemmap.c @@ -48,7 +48,7 @@ static int __split_vmemmap_huge_pmd(pmd_t *pmd, unsigned long start) pmd_populate_kernel(&init_mm, &__pmd, pgtable); - for (i = 0; i < PMD_SIZE / PAGE_SIZE; i++, addr += PAGE_SIZE) { + for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { pte_t entry, *pte; pgprot_t pgprot = PAGE_KERNEL;