Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1566455rwb; Wed, 28 Sep 2022 22:01:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5nI7H2rQSDi2dcUEOyhkc+/twtnZkIOcRxJgwY92MXsN4Db8GWiPuxo1YpVsxVTp/AVWkn X-Received: by 2002:a63:b504:0:b0:43c:e5f5:8be3 with SMTP id y4-20020a63b504000000b0043ce5f58be3mr1250068pge.345.1664427691523; Wed, 28 Sep 2022 22:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664427691; cv=none; d=google.com; s=arc-20160816; b=HnqesAuDpHKroJSfwSU8oITbyUO+R4XiVUV7j4kFSqDWBO7+sCdAf861rzoo6gvTNw NFsabkSyjSbNJs/wrgbhIER0V5LqX144hNgbaGqD2K66xhoYov2iOCD1nL71QNdCx7ZK QedRQI5/QXwm4Vv9UtkpGE321RxFfGZXAsun3SbYZcsQKwIzOriA3il/hyS3kvFgOK2u lFGZwzqd9kpadGy3FsXczdgphEZlk44CuPhRP6xiJfBISqKXh9xaTBYF9hS8JfwT9Bo+ N3iRQTkPXP6IA1WJY5hIU5jVzidANHzCrSRJiKjR6GNnbBv6p7r2yBdAveLhiCGTdb50 axHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=oR8kEmKepn1OxcoDnk+3+f0BMSGhXeHUAukDiRlODV8=; b=MQkO5kpMB2hlweWG5GZO/j2v4X6Fq1YWgEshX2UpN/scloInR6+LRKbI/hOQ1oyjXX KuAFU7eBttIsWzUz4xnjECcA0wRhsTzGpBq6gxxEfkkdBc9UdgeQx593ajGRDr8YPtJ3 2SqJb3CUJkzXwRCqfovJ94MGEYeiiswwbbF00n8RGbPE3Bubhey4jXRm7QFgnIkl8YeD NqJMBKPcT12LsWtez9XhPRKTcSKaR2nWviAjoxWugodTFrs40TWOoZByIgoFOSuyvLvt yOl5MIfToZopbncmcerbFLexOAtcTvnOtRiiGvvsL2qC2KlQvCm3MCYl9DVUecficIBP 4FFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=YzUZIxmC; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u190-20020a6385c7000000b004403f8dd0e8si1641529pgd.760.2022.09.28.22.01.19; Wed, 28 Sep 2022 22:01:31 -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=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=YzUZIxmC; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234453AbiI2DrX (ORCPT + 99 others); Wed, 28 Sep 2022 23:47:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229508AbiI2DrV (ORCPT ); Wed, 28 Sep 2022 23:47:21 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B86F011D0CF for ; Wed, 28 Sep 2022 20:47:20 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id bh13so349260pgb.4 for ; Wed, 28 Sep 2022 20:47:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date; bh=oR8kEmKepn1OxcoDnk+3+f0BMSGhXeHUAukDiRlODV8=; b=YzUZIxmCSK3Cc3CddDpRnQcarNDoKYyfhVUMJbPXN15NYXsk3ACA8BeNC7U1O88cJK uACyigsZ+waxZl7/K9rMWjqKCJECowNnHRfyKUK4z2SWmVocUWEXDz2tPR4A2k/Ao3bZ EvbdV+29w8bdwHzsoDo9uz1jd2AY/L520RrIyiyBW8VUkg4ghjfmWUt5rar+07g5IMlf Eu7jG5JipxB1D3qDYtkRYM/HmNiQnNk7TTfHMTC58ggl9TIhq9CF97P5nud+FjXc97hc VLVe6jS/KGKASeczLYh7q9FJ8Tg2eU3bUgr6V6ae5Tk2QJqZA03VrIYotYclq6z00wMC mG7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date; bh=oR8kEmKepn1OxcoDnk+3+f0BMSGhXeHUAukDiRlODV8=; b=V0tmoRJHPFPqugqI/vExOeCRyFd6YlaGkgzy5rbXoOR4/GvgwMQWY053SR2xoKZCnt 8cHWL1NzD5bYRqeukQkngdOvKu7MPT41kMKJcp2HW6CZkmTEs9U7VG42B3hc0gL6QB6V X3DYHjSVObkYbANf2u//PiqLldNVzGjWmbyC4Nu84GjrKQ9nV4WWW3/M5Z9ZHN01cvwM vRIZbQcg8Ul1x67J0pCQzpUHkolS+QAGZKzAY9V6pKzbgWcJAXQ1dTDbFkGKoaUCtHDR E0eZefs/n4Gq20ljyvwQ/OqeiK43mw6hybpBDU/v0xEFvov+0ByX4pALsFyZZnEFKCxC 9hVQ== X-Gm-Message-State: ACrzQf1b8NaT7XvNMyLZ/jYjVDJZ07HQv5X1bOhLwvH4jhFVSFWjJgP7 myCMnheS/5dnYXlZ+n8A/gfSxA== X-Received: by 2002:a05:6a02:30c:b0:43c:7c23:4717 with SMTP id bn12-20020a056a02030c00b0043c7c234717mr1100246pgb.412.1664423240257; Wed, 28 Sep 2022 20:47:20 -0700 (PDT) Received: from [10.4.189.225] ([139.177.225.254]) by smtp.gmail.com with ESMTPSA id e22-20020a63f556000000b0041c0c9c0072sm4340782pgk.64.2022.09.28.20.47.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Sep 2022 20:47:19 -0700 (PDT) Message-ID: Date: Thu, 29 Sep 2022 11:47:13 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 Subject: Re: [PATCH v2] mm: use update_mmu_tlb() on the second thread Content-Language: en-US To: maobibo , David Hildenbrand , akpm@linux-foundation.org, muchun.song@linux.dev, =?UTF-8?B?6ZmI5Y2O5omN?= Cc: chris@zankel.net, jcmvbkbc@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Muchun Song References: <20220926115621.13849-1-zhengqi.arch@bytedance.com> From: Qi Zheng In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 2022/9/29 11:27, maobibo wrote: > 在 2022/9/29 11:07, Qi Zheng 写道: >> >> >> On 2022/9/26 22:34, David Hildenbrand wrote: >>> On 26.09.22 13:56, Qi Zheng wrote: >>>> 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. >>>> >>>> Signed-off-by: Qi Zheng >>>> Reviewed-by: Muchun Song >>>> --- >>>> v1: https://lore.kernel.org/lkml/20220924053239.91661-1-zhengqi.arch@bytedance.com/ >>>> >>>> Changelog in v1 -> v2: >>>>   - change the subject and commit message (David) >>>> >>>>   mm/memory.c | 2 +- >>>>   1 file changed, 1 insertion(+), 1 deletion(-) >>>> >>>> diff --git a/mm/memory.c b/mm/memory.c >>>> index 118e5f023597..9e11c783ba0e 100644 >>>> --- a/mm/memory.c >>>> +++ b/mm/memory.c >>>> @@ -4122,7 +4122,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) >>>>       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; >>>>       } >>> >>> >>> Staring at 7df676974359, it indeed looks like an accidental use [nothing else in that patch uses update_mmu_cache]. >>> >>> So it looks good to me, but a confirmation from Bibo Mao might be good. >> >> Thanks, and Hi Bibo, any comments here? :) > > update_mmu_tlb is defined as empty on loongarch, maybe some lines should > be added in file arch/loongarch/include/asm/pgtable.h like this: Seems like a bug? Because there are many other places where update_mmu_tlb() is called. > > +#define __HAVE_ARCH_UPDATE_MMU_TLB > +#define update_mmu_tlb update_mmu_cache If so, I can make the above as a separate fix patch. Thanks, Qi > > regards > bibo mao >> >>> >> > -- Thanks, Qi