From patchwork Wed Oct 18 14:08:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kefeng Wang X-Patchwork-Id: 154898 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp4818350vqb; Wed, 18 Oct 2023 07:10:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFtqvAiP1eqMwhjzCcjc99D7ANyPCOaII6nAVzQqSRW9xHivbn5+sbeISQhPVenyhlN5X/R X-Received: by 2002:a05:6a21:8cc5:b0:15c:b7ba:e9ba with SMTP id ta5-20020a056a218cc500b0015cb7bae9bamr4791392pzb.0.1697638206714; Wed, 18 Oct 2023 07:10:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697638206; cv=none; d=google.com; s=arc-20160816; b=yn+IQbrp2c8rjsxtTWrIrXspUs4uvi4gqNxa/HoZvgyIlbsg6lSu7JkNq4mPOfUgKT M/UoPV+lDSZK+nkd5oSzFC6YrXih+LUZbfjlZw3yig4vcvxzzgZfM7SjpjNS3OPgH9ii UoEFZoksYgezqnmrB2ekn8kZpfTR35/nnvo7zIM1bMycy4wjX2VgccJiNBAJlCVcWerT rZfAfDFAT+/R7V0K0H8AcICODLRn4XtAU3sVAhvGmysnXH02YiptTk0DN4pbPv78CU+8 Ts6oCVz9OB/Bl9qrfkXs7pP77lIKQCFSyuWZOSJUf1nO+F1bXaPVsxIha75if0xBJkGp GkDA== 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=z6mhHbia0tgVbcgOllnNbvBMUqnXaQ9x0wWBWtbmQ/I=; fh=Q+Hibf2y+6rOlBpt37Lm5i0wTMmcQsnxMBqJTtvbZCs=; b=E6MajkTowMKZ81UtmOK5Di7ay/ac/bt8Yp7wmhSLnGoNVevOHXC6uvVgQCneBlW+e7 rZGuCFiOyzZRzYsNQ1O5Lvi9pdgkAVWjzPM5DFpPYjGyxH54R/omjRvWOtx6d6aY/NdQ h+G/hv7FhA9ru2R/57MZVmLBtXxLcLMIJatgb7nws4EcOcbcnB5sd+1zfGz1xenGpRAx 3l75P4aKn1JslImDCs/ZFhaeMkXwfyMlEMLYDZ4XxlGZp+cO6kXOWm6gvFaerjkqN7Qr NwgvmJEYq3k8N0CFWKsZqZJqs2/m6XusQ5CH6I3WujneYtIQetN01weobzmUA+jy14hG VKwg== 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 i131-20020a636d89000000b005655bf61e32si2151111pgc.23.2023.10.18.07.10.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 07:10:06 -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 8B34C816692E; Wed, 18 Oct 2023 07:10:05 -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 S1344944AbjJROJ6 (ORCPT + 23 others); Wed, 18 Oct 2023 10:09:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41040 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344890AbjJROJT (ORCPT ); Wed, 18 Oct 2023 10:09:19 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C823E11A for ; Wed, 18 Oct 2023 07:09:12 -0700 (PDT) Received: from dggpemm100001.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4S9XhL4X7YzrTQF; Wed, 18 Oct 2023 22:06:26 +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; Wed, 18 Oct 2023 22:09:09 +0800 From: Kefeng Wang To: Andrew Morton CC: , , , , , Zi Yan , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Kefeng Wang Subject: [PATCH v3 18/19] mm: use folio_xchg_last_cpupid() in wp_page_reuse() Date: Wed, 18 Oct 2023 22:08:05 +0800 Message-ID: <20231018140806.2783514-19-wangkefeng.wang@huawei.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> References: <20231018140806.2783514-1-wangkefeng.wang@huawei.com> MIME-Version: 1.0 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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS 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]); Wed, 18 Oct 2023 07:10:05 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780102680424071058 X-GMAIL-MSGID: 1780102680424071058 Convert to use folio_xchg_last_cpupid() in wp_page_reuse(), and remove page variable. Since now only normal and PMD-mapped page is handled by numa balancing, it's enough to only update the entire folio's last cpupid. 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 037da118f1d1..4f0dfbd5e4bf 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 folio's 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);