Message ID | 20231103140119.2306578-14-wangkefeng.wang@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:8f47:0:b0:403:3b70:6f57 with SMTP id j7csp1056117vqu; Fri, 3 Nov 2023 07:04:42 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjly/TOLu2bPMJApltLTcVjKlAClFwfMJW/Dak17/L0rengWGBC/keGyudjof4TlZiD3ga X-Received: by 2002:a17:902:c641:b0:1cc:2bd9:1b2d with SMTP id s1-20020a170902c64100b001cc2bd91b2dmr14208602pls.43.1699020282363; Fri, 03 Nov 2023 07:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1699020282; cv=none; d=google.com; s=arc-20160816; b=bph77xvCYvanOHEHbgFeDgC1evMPBx9epNyNP2m2WTDcbfmuBpz2IFqXBxXqYqfF4M UbfIWdYVL2YOQ7f2yO3kae/X7eJCh4oxwKapGzba4LTggU0wlt7GJxN6HSS4He6B169a jujmRBHaYrAIcrVHv/Cro5h7MulpPfkxNHqXBBN/vrtxHYI4tDwD7c9uqe/psihW+ucE b9tlM13Ky14cbYAl0eFfq2oszPusfMCYQjVg3T5EzHsE7884siOUJuAbH4GTXBeqI5K3 ZphdRoySYfukO7CPpbmGymEH41jyKNPcdu5qLPXQZGHOBOmqMCdtZ9h5AOVeNxZf2v08 ryMQ== 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=MdhMIc9GunfmcgvY7/8IJnElK+TVJK6hHFkN45VneUA=; fh=kUj/5waaepfljbNx30rj2BALdV0u/mUCTaFWThlgquQ=; b=h6Z7jHjPczcGr2pGR8Ijx7zF5d0679+zqk9cbf5sBQF7RT0B/WOzC67WdOvq5I5n/N hgMwgEcCcaRKvVknUYvyHX4s5WbA18NPgiPTr63DJ0uMNh24WnK+90iWAPrJzGx543p0 e4MQE7f0H4fWCGsT3ssQiQ4ZTrmGBqOAv3i8e0YoBU+o5LzasZ3Xjw8eMc7vqAnEragl Cc+ENdcWe52vso8HinoW6DENjM2J+dbJQc7UpXFB1WPjNZbiHCqrpJ6kGjTHmbTNwFIV 6u4cVbT91qhR2xoh05HMtMf+H3foyu44qOLARhZo10owN0SYBwHOFhzpp33ih7Q9UBzP gzcg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id kg15-20020a170903060f00b001c62d93585csi1485122plb.611.2023.11.03.07.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 07:04:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 C669182CEE46; Fri, 3 Nov 2023 07:04:32 -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 S1377864AbjKCOEO (ORCPT <rfc822;lhua1029@gmail.com> + 36 others); Fri, 3 Nov 2023 10:04:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377848AbjKCOEC (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Nov 2023 10:04:02 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EEE8D4D; Fri, 3 Nov 2023 07:03:55 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4SMMpQ12P0z1P7pT; Fri, 3 Nov 2023 22:00:46 +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:48 +0800 From: Kefeng Wang <wangkefeng.wang@huawei.com> To: Andrew Morton <akpm@linux-foundation.org> CC: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>, Matthew Wilcox <willy@infradead.org>, David Hildenbrand <david@redhat.com>, <linux-s390@vger.kernel.org>, Kefeng Wang <wangkefeng.wang@huawei.com> Subject: [PATCH 13/18] mm: memory: use a folio in insert_page_into_pte_locked() Date: Fri, 3 Nov 2023 22:01:14 +0800 Message-ID: <20231103140119.2306578-14-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: <linux-kernel.vger.kernel.org> 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:04:32 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781551891342277063 X-GMAIL-MSGID: 1781551891342277063 |
Series |
mm: convert to use folio mm counter
|
|
Commit Message
Kefeng Wang
Nov. 3, 2023, 2:01 p.m. UTC
Use mm_counter_file_folio() to save one compound_head() call in
insert_page_into_pte_locked().
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
mm/memory.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/mm/memory.c b/mm/memory.c index 2d90da70a1c8..584fe9a550b9 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1845,11 +1845,14 @@ static int validate_page_before_insert(struct page *page) static int insert_page_into_pte_locked(struct vm_area_struct *vma, pte_t *pte, unsigned long addr, struct page *page, pgprot_t prot) { + struct folio *folio; + if (!pte_none(ptep_get(pte))) return -EBUSY; + folio = page_folio(page); /* Ok, finally just insert the thing.. */ - get_page(page); - inc_mm_counter(vma->vm_mm, mm_counter_file(page)); + folio_get(folio); + inc_mm_counter(vma->vm_mm, mm_counter_file_folio(folio)); page_add_file_rmap(page, vma, false); set_pte_at(vma->vm_mm, addr, pte, mk_pte(page, prot)); return 0;