Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4257787rwb; Fri, 30 Sep 2022 15:43:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6LBDQtvlU5laU/PznakvekyWHAZyY/UiIDlF3TJIp1d8cfBKRyPjp649dOgrCo/zpDb8g0 X-Received: by 2002:a17:907:6095:b0:787:bebe:ff6f with SMTP id ht21-20020a170907609500b00787bebeff6fmr7913077ejc.513.1664577813445; Fri, 30 Sep 2022 15:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664577813; cv=none; d=google.com; s=arc-20160816; b=fHOskrgQnzyh/B+evMgn5dJAnGuahkVSg/M0dqUbSthSQbvszkMdWg6JFSRf8PObfB OKvCQVE/k96y6DUJcrq4ngXTA+XlVpoiSkYVdKiRlZR+X4EbHifQjxIRK+3gU+Vsph6b cuaXnPnFIHRjOLkp5N09wk+Z5lu8WFjjUnHwSjtf1az8qKkS0tw+rZ8Yd8v3FDP2g8o7 JlULbgbEKnvTRPt16cCW+PphQmy+QSVGB6Bq/agHhM/Pr8jSu1tNt2un4/zNPO6KT0QS CRiJndNLDBTUunUqK6TZaEWR1MxeEDfut5AMe1ie0DRw2ZmDwwJHK45uxG3goNrngR+6 CKCw== 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:subject:cc:to:from:date :dkim-signature; bh=Urn+WNLZaT4YE8YPnEqKd6hSwBQo3p5kgDR3Qhw7CDA=; b=jZJtMUMpQ8L7/VH9OYQ3oU7mcI3LTorOT16Zfcwq6Kek/WcnylED/El3UmnBxO4uCl xcBDkAecn04cAKh93gH7WC0G2I4BxwwJYSAclTKBK9K2GSapDM3uquNKB1Tvtdn2wgla U29sP2T1WkUiGjPxvLzL3VvhKtNU8RG1VXgU2YMqz2Q5onTho9wWtBDk9+7OY//g1Qw4 Pk9CKG3r1ARMaUYhLxHXPQjIT9IRy+5FLYejeDvJ/NXNezIoFOlNdqnY0xKEObtWvIw+ HhUjVSJFlTP2uUsNpVgEoX115QyqPjVFPRGcwaA0p4svSIMYUnCWSJxB01UP18IN/JoC xpGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=pM0+nGgF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id di19-20020a170906731300b0077441079bfbsi2815912ejc.434.2022.09.30.15.43.06; Fri, 30 Sep 2022 15:43:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=pM0+nGgF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231686AbiI3Wbn (ORCPT + 99 others); Fri, 30 Sep 2022 18:31:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229779AbiI3Wbk (ORCPT ); Fri, 30 Sep 2022 18:31:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8363415D110 for ; Fri, 30 Sep 2022 15:31:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 43128B82A76 for ; Fri, 30 Sep 2022 22:31:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 87849C433C1; Fri, 30 Sep 2022 22:31:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1664577096; bh=EkVrlHyTVHUTLwQT4CnvETp8bpncjOLRpYeapD2l0s4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=pM0+nGgFgs0WV9gN28yx7k0+vLSSZRaTVneZS6x7pS0lpBtyXHt5fcsZbzYtljigx bEUBk+8XB2f6HgCfzVUsnxUQOaHV9LFgjoaOdp0bDfa5SA6RwF0PUvqqV/Kl8soxAP A7suUUihYOJHwJl41hkMVasX7RMKdpQ/lJVJ2Pd8= Date: Fri, 30 Sep 2022 15:31:35 -0700 From: Andrew Morton To: David Hildenbrand Cc: Qi Zheng , maobibo@loongson.cn, chenhuacai@loongson.cn, songmuchun@bytedance.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, loongarch@lists.linux.dev, chris@zankel.net, jcmvbkbc@gmail.com Subject: Re: [PATCH v3 1/2] mm: use update_mmu_tlb() on the second thread Message-Id: <20220930153135.164240eadc71ddf94d8200fb@linux-foundation.org> In-Reply-To: <673e494c-eb91-470a-026b-59e414d0916e@redhat.com> References: <20220929112318.32393-1-zhengqi.arch@bytedance.com> <20220929112318.32393-2-zhengqi.arch@bytedance.com> <0fecbcdc-7324-2d76-8452-b60b4638d074@redhat.com> <32a53a8f-f6f8-6efc-a5f6-a004ffab8c99@bytedance.com> <673e494c-eb91-470a-026b-59e414d0916e@redhat.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, 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 On Fri, 30 Sep 2022 10:44:21 +0200 David Hildenbrand wrote: > > Oh, this is better. Hi Andrew, do I need to resend the v4? > > > > I assume he can squash it, most probably no need to resend. :) From: Qi Zheng Subject: mm: use update_mmu_tlb() on the second thread Date: Thu, 29 Sep 2022 19:23:17 +0800 As message in commit 7df676974359 ("mm/memory.c: Update local TLB if PTE entry exists") said, we should update local TLB only on the second thread. So in the do_anonymous_page() here, we should use update_mmu_tlb() instead of update_mmu_cache() on the second thread. As David pointed out, this is a performance improvement, not a correctness fix. Link: https://lkml.kernel.org/r/20220929112318.32393-2-zhengqi.arch@bytedance.com Signed-off-by: Qi Zheng Reviewed-by: Muchun Song Acked-by: David Hildenbrand Cc: Bibo Mao Cc: Chris Zankel Cc: Huacai Chen Cc: Max Filippov Signed-off-by: Andrew Morton --- mm/memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/mm/memory.c~mm-use-update_mmu_tlb-on-the-second-thread +++ a/mm/memory.c @@ -4136,7 +4136,7 @@ static vm_fault_t do_anonymous_page(stru vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); if (!pte_none(*vmf->pte)) { - update_mmu_cache(vma, vmf->address, vmf->pte); + update_mmu_tlb(vma, vmf->address, vmf->pte); goto release; } _