From patchwork Fri Oct 13 08:56:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 152420 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp1751909vqb; Fri, 13 Oct 2023 01:59:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFp+88TiW0dXvmW8axuFd7tX8xeWGB7Xv9CGGYsLY7acvHS/7JYLK3XrdHHQG2HXcSMQ8Jh X-Received: by 2002:a05:6359:b9a:b0:14d:2dd5:a777 with SMTP id gf26-20020a0563590b9a00b0014d2dd5a777mr22749683rwb.2.1697187586301; Fri, 13 Oct 2023 01:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697187586; cv=none; d=google.com; s=arc-20160816; b=QqIJE0AcK5uhlv5A3hTEX4d7UlDKFYmVLT0mHm0BlsVq25egRsNBN3zeoHxp3/6fft ixK3kJ7eP849gm03iIGDaei+kwUTfMuxoil+Z2Cx6TOnL96KJ+4f6aW1N8st8943KMEo A2P3emwu0qisbu+cKjenyQ+vWH6VQeOTnPyH4AEXPNFSIDx47ez8jhPZAnSu2lrBSE5a UObCIIu4BZOxKZNVG+LSwJ4FV2rQOWg41f2lfCmDM9frjW3cA1j2+3qgGy8BbxHXQncx svb9rcGR3fmWUzOwyQJsWERxEPghg+dk4FRk+v1TrOXef3s5CphkjVrIyHzAId7gsGOV QVhA== 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=73qbkeRYK0UwEo09b8YO/gA+ZBZX23AWTiCUsRN78/g=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=vmNpsg01WONmUWxg3gBykAdi1EOgafDsaWTHz//rGGdD4PwFgqnTWSAoWc17sboyR4 6mFgTEegiQDiSrUjB8zXddAWkrNIPbH0D1ZU/iA4/GU97/a3Zq3OJPHpQCWr0Su+mWcK xgGjMKK6gKSw1tLRpx1ujlV//2bC0m3EMZKZf2U3ok3za8biLbPzVba3Wc7RfCCMe3Cn If4mbMb4QbLryV2Mj5+pRbccL8WTbzUscRQd2bEKlZJK/Jpb4fbj1msXCNAGtCDIb5Cl St73kzUVh50cdv+DUywWECQdV2ZLEHKBiGojfT1LPvbosmBKV9JO57SnxsxRaf2fe8Ve XVvA== 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 bt8-20020a632908000000b005891a066de8si4044813pgb.416.2023.10.13.01.59.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 01:59:46 -0700 (PDT) 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 A09F9839D9E4; Fri, 13 Oct 2023 01:59:38 -0700 (PDT) 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 S230420AbjJMI7Z (ORCPT + 19 others); Fri, 13 Oct 2023 04:59:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230349AbjJMI6f (ORCPT ); Fri, 13 Oct 2023 04:58:35 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B115C9 for ; Fri, 13 Oct 2023 01:58:33 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4S6L0p5GHyzLqXs; Fri, 13 Oct 2023 16:54:34 +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, 13 Oct 2023 16:58:31 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH -next v2 18/19] mm: use folio_xchg_last_cpupid() in wp_page_reuse() Date: Fri, 13 Oct 2023 16:56:02 +0800 Message-ID: <20231013085603.1227349-19-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231013085603.1227349-1-wangkefeng.wang@huawei.com> References: <20231013085603.1227349-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) 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 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: 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]); Fri, 13 Oct 2023 01:59:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779630170743612923 X-GMAIL-MSGID: 1779630170743612923 Convert to use folio_xchg_last_cpupid() in wp_page_reuse(), and remove page variable. Signed-off-by: Kefeng Wang --- mm/memory.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 6b58ceb0961f..e85c009917b4 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -3022,19 +3022,20 @@ static inline void wp_page_reuse(struct vm_fault *vmf, struct folio *folio) __releases(vmf->ptl) { struct vm_area_struct *vma = vmf->vma; - struct page *page = vmf->page; pte_t entry; VM_BUG_ON(!(vmf->flags & FAULT_FLAG_WRITE)); - VM_BUG_ON(folio && folio_test_anon(folio) && !PageAnonExclusive(page)); - /* - * Clear the pages cpupid information as the existing - * information potentially belongs to a now completely - * unrelated process. - */ - if (page) - page_cpupid_xchg_last(page, (1 << LAST_CPUPID_SHIFT) - 1); + if (folio) { + VM_BUG_ON(folio_test_anon(folio) && + !PageAnonExclusive(vmf->page)); + /* + * Clear the pages cpupid information as the existing + * information potentially belongs to a now completely + * unrelated process. + */ + folio_xchg_last_cpupid(folio, (1 << LAST_CPUPID_SHIFT) - 1); + } flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte)); entry = pte_mkyoung(vmf->orig_pte);