Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp533400rdf; Fri, 3 Nov 2023 07:47:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGxZkPhRYyoVmhwToREG7Ab32/xSxr5n6CphMl81GoyCOZHapXtvb1momuqocT+ZRjyORSJ X-Received: by 2002:a17:903:288b:b0:1c5:6157:f073 with SMTP id ku11-20020a170903288b00b001c56157f073mr21786787plb.11.1699022853522; Fri, 03 Nov 2023 07:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699022853; cv=none; d=google.com; s=arc-20160816; b=KjDM24scNIcamNoBeJXH176UeqWpgtvnDLlaocKQ39DQeTE419qzIP7jHdbTB5yOgi EmYKJm6qZPJY0pcR1DiLI1AWkiqFjUeztuFDg70V6PTQ9TXwMG4a6hQUCZUvIw/AA61j ul+d5IP4hdnqPNlQW6wqIfTau4pE3YPwwZ99VEx0NBKQoAEA/u1+9aOTb3Tyww21np6W FrV/DMcqQnVtnc4qonLlk6ikLJZVm8oT5+GACCxMHn28wSbt4waBWxTnSpdZMXSfyfLA rRXkLA2yLGmiTxG/h3ztj+ntP35Ed6hTmAeuOQixf3axDx+sI3VNGukDlr/Ts5TrT2dI gyqQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/HAJ8XbTBaLTFFDB1GrLQZOkpvtPmYqj4jF+Og1D+HM=; fh=kUj/5waaepfljbNx30rj2BALdV0u/mUCTaFWThlgquQ=; b=xnCalo9kNsfTmExVIyMWnBFxljIqS6lw3POLs3LRbtnmRxaupq8+vaANryfZpKcrYG 69HIrMC04JIDf3Kk2ZeeuHKD/uMZEEAqcSwc5qNzbOGpsodsPOWdSFVsElFUtwVeIt9P 0QBEyQBPv7ZenHxBDgQlgq6FbCyr1d9ZfCtjZ0AXjRyLZo+YvY+OMDD+gS8YA780eqL9 aqSPs4jdd/pDX372tEkOj5dcgs3cYptV7cI5GchtfuOFPJcIz6d+iKqJS+LuPyh+b1Uc Q3qcUSLkKzuQore37Sq5n4L7ZbuAvAAgZG4iJU9Cb29yV3+lF2dlol52cNS4B41KQVaH YNQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id ky4-20020a170902f98400b001b6ae9f8bb1si1583617plb.75.2023.11.03.07.47.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 07:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C6ED08095002; Fri, 3 Nov 2023 07:46:04 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229863AbjKCOp6 (ORCPT + 99 others); Fri, 3 Nov 2023 10:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377811AbjKCODz (ORCPT ); Fri, 3 Nov 2023 10:03:55 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45390D59; Fri, 3 Nov 2023 07:03:51 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SMMpP5NHRz1P7nG; Fri, 3 Nov 2023 22:00:45 +0800 (CST) Received: from localhost.localdomain (10.175.112.125) by dggpemm100001.china.huawei.com (7.185.36.93) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 3 Nov 2023 22:03:45 +0800 From: Kefeng Wang To: Andrew Morton CC: , , Matthew Wilcox , David Hildenbrand , , Kefeng Wang Subject: [PATCH 07/18] mm: huge_memory: use a folio in zap_huge_pmd() Date: Fri, 3 Nov 2023 22:01:08 +0800 Message-ID: <20231103140119.2306578-8-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231103140119.2306578-1-wangkefeng.wang@huawei.com> References: <20231103140119.2306578-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 03 Nov 2023 07:46:05 -0700 (PDT) Use a folio in zap_huge_pmd() which replaces two compound_head() call with one page_folio() call. Signed-off-by: Kefeng Wang --- mm/huge_memory.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 054336ecab0a..2dba4d3aa2d3 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1717,6 +1717,7 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, spin_unlock(ptl); } else { struct page *page = NULL; + struct folio *folio = NULL; int flush_needed = 1; if (pmd_present(orig_pmd)) { @@ -1734,13 +1735,14 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, } else WARN_ONCE(1, "Non present huge pmd without pmd migration enabled!"); - if (PageAnon(page)) { + folio = page_folio(page); + if (folio_test_anon(folio)) { zap_deposited_table(tlb->mm, pmd); add_mm_counter(tlb->mm, MM_ANONPAGES, -HPAGE_PMD_NR); } else { if (arch_needs_pgtable_deposit()) zap_deposited_table(tlb->mm, pmd); - add_mm_counter(tlb->mm, mm_counter_file(page), -HPAGE_PMD_NR); + add_mm_counter(tlb->mm, mm_counter_file_folio(folio), -HPAGE_PMD_NR); } spin_unlock(ptl); -- 2.27.0