From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C3AB0C433FE for ; Fri, 30 Sep 2022 22:31:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 220E06B0072; Fri, 30 Sep 2022 18:31:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D0836B0073; Fri, 30 Sep 2022 18:31:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0720E8D0001; Fri, 30 Sep 2022 18:31:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id ECBFD6B0072 for ; Fri, 30 Sep 2022 18:31:39 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id AE61BC0252 for ; Fri, 30 Sep 2022 22:31:39 +0000 (UTC) X-FDA: 79970199918.11.97268E9 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf17.hostedemail.com (Postfix) with ESMTP id 46C6040005 for ; Fri, 30 Sep 2022 22:31:38 +0000 (UTC) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 7BE71623C4; Fri, 30 Sep 2022 22:31:37 +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 ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=pM0+nGgF; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664577098; a=rsa-sha256; cv=none; b=Ya95Ci1g76BhHD3BoN9wRS/7HyVziWx4Z0VmpRc17ieh03zaNxX7J5rV/3wAch6D360lxG VBm5nmg68oxF97VsDX+hbJ25AlzHxcIKSt9ccNlGUvgFXFR02ivXaW1ia1UihxneC2zhw6 ZMNVUNp7CxZC5bTe/7/9Yvm3HbGoZus= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664577098; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Urn+WNLZaT4YE8YPnEqKd6hSwBQo3p5kgDR3Qhw7CDA=; b=EBnHwa5imP9fM3yh1pkweS5glVbUAgqxr4jjtwujKu7HypXzI70rNVgngY3bLpP8xygIgM hZgI79XTwM+RtUfhE/aPSVAmBDpcvA0er7IOGTwU8QuRrFITrlWA/te31wSTbWrPSsqQlH hCvwTRn/tzX8DNNFlZibsIyxmJHdXXE= X-Rspam-User: Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=pM0+nGgF; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Server: rspam10 X-Stat-Signature: yrpitze8en1magnt91jfyxnhsg5psa1c X-Rspamd-Queue-Id: 46C6040005 X-HE-Tag: 1664577098-784208 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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; } _