Message ID | 20231107135216.415926-3-wangkefeng.wang@huawei.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:aa0b:0:b0:403:3b70:6f57 with SMTP id k11csp247134vqo; Tue, 7 Nov 2023 05:55:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEjjHU7fKQj2o9SKkBZCRVghg+9DuLCpsayx+proccXgxe/o/Nxn3soLoQo33U7+yG2rVpz X-Received: by 2002:a17:902:dacb:b0:1cc:6f7b:636a with SMTP id q11-20020a170902dacb00b001cc6f7b636amr20537275plx.2.1699365305418; Tue, 07 Nov 2023 05:55:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1699365305; cv=none; d=google.com; s=arc-20160816; b=OtD5TXwSPPD36tS+TbhA6pohYdfnPVcgwrlc+yp0bChaEPjTT4QmoFV83bpafpdHMs JtEdhHI9Em/wpoNFvrNbxl9a9siG3Z+61CzkbGv0kWhrsz/gwTVbJbW9m3/6RovPO5eC J79lz9A0CsxiMsxzHwZ4TiMsDw+4MlaQyE8svOxbO1erDMuvfSow+eTPxqazdlSKnN2i m6ylxr+2ZDYy3tSc98wOLKTSvoEtiLJmaYgXndWmZF4OQNgvp3hLwS/3MNVKQ2OGWRAY FN6IB3/4FD9hELPtjqfz6nU6I0zZ4J2P5pR3F7bWPTJBp7mwrRRLgGcHXNHml1ZUPugw moCA== 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=HTwqTJZP/kylVWu0m1TUQf16I6uo3SZHS8jdaln9Ki0=; fh=mT5bKTeask8yf/HL65t+eda2+hCp7isEA6/Uj2VbVV4=; b=Tx4Wrom/v4gJ+cOSJl40GkqP0crzhbwbYskuUsWCSZIQGqPkY7xT9A+lEeLS0LsALT wz+ZJQYe+qM3Ydertx6kZP5OL2s3slrYCRyZloui3YPxLUDmcgdpqMQHUPw2cJC+U6fK SwA9zX65RXfMgXMx4hS5SpOgJfGvG7vcVszP9UvBJZfjmMQ9paO1W5AIXx57vuYOdFII /HsBiJHgvCZlaQp4MsnI6qp2pVhoqM2ZcvGE76F70AUleZRzGDmErrVaGW0TsohTVMBw m/A+f5L0rQx/yaiScyGbf5mRVofP6pws1FGUPXhxlt7ZrqGQCcFSNnSLoNCzo9RE+vRs d2rQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id b15-20020a170902d50f00b001c9db56c09asi11298143plg.144.2023.11.07.05.55.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Nov 2023 05:55:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (Postfix) with ESMTP id AC271801B70A; Tue, 7 Nov 2023 05:54:47 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235160AbjKGNxx (ORCPT <rfc822;lhua1029@gmail.com> + 32 others); Tue, 7 Nov 2023 08:53:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234859AbjKGNxa (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 7 Nov 2023 08:53:30 -0500 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A133BD for <linux-kernel@vger.kernel.org>; Tue, 7 Nov 2023 05:52:54 -0800 (PST) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4SPqLK0NQlzMm4V; Tue, 7 Nov 2023 21:48:25 +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; Tue, 7 Nov 2023 21:52:52 +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>, Kefeng Wang <wangkefeng.wang@huawei.com> Subject: [PATCH 2/6] mm: memory: use a folio in validate_page_before_insert() Date: Tue, 7 Nov 2023 21:52:12 +0800 Message-ID: <20231107135216.415926-3-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231107135216.415926-1-wangkefeng.wang@huawei.com> References: <20231107135216.415926-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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemm100001.china.huawei.com (7.185.36.93) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-0.8 required=5.0 tests=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 fry.vger.email 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 (fry.vger.email [0.0.0.0]); Tue, 07 Nov 2023 05:54:47 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781913674813963059 X-GMAIL-MSGID: 1781913674813963059 |
Series |
mm: cleanup and use more folio in page fault
|
|
Commit Message
Kefeng Wang
Nov. 7, 2023, 1:52 p.m. UTC
Use a folio in validate_page_before_insert() to save two
compound_head() calls.
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
mm/memory.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
Comments
On 11/7/23 5:52 AM, Kefeng Wang wrote: > Use a folio in validate_page_before_insert() to save two > compound_head() calls. > > 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 1f18ed4a5497..b1bff4d245da 100644 > --- a/mm/memory.c > +++ b/mm/memory.c > @@ -1836,9 +1836,12 @@ pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, > > static int validate_page_before_insert(struct page *page) > { > - if (PageAnon(page) || PageSlab(page) || page_has_type(page)) > + struct folio *folio = page_folio(page); > + > + if (folio_test_anon(folio) || folio_test_slab(folio) || > + page_has_type(page)) > return -EINVAL; > - flush_dcache_page(page); > + flush_dcache_folio(folio); > return 0; > } > Reviewed-by: Sidhartha Kumar <sidhartha.kumar@oracle.com>
diff --git a/mm/memory.c b/mm/memory.c index 1f18ed4a5497..b1bff4d245da 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1836,9 +1836,12 @@ pte_t *__get_locked_pte(struct mm_struct *mm, unsigned long addr, static int validate_page_before_insert(struct page *page) { - if (PageAnon(page) || PageSlab(page) || page_has_type(page)) + struct folio *folio = page_folio(page); + + if (folio_test_anon(folio) || folio_test_slab(folio) || + page_has_type(page)) return -EINVAL; - flush_dcache_page(page); + flush_dcache_folio(folio); return 0; }