Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp148106lqp; Tue, 21 May 2024 23:13:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWNDaLVSGAqfttBhPZfDGn5Fd176gvW5RJvvKK2UhRCC/ZRdDt505t4tCK3o+mVW5yi4uFA0LnTudjdL1HJqf5pjqcdVeumqvr816Bnhw== X-Google-Smtp-Source: AGHT+IGR3Aie5LKAyBg5Pia25QS9lZCaY+cAxhS+YPKgscaaYN+l/P2WqvQEPEcyxyEOQr1pp29G X-Received: by 2002:a50:cd01:0:b0:574:eb80:3305 with SMTP id 4fb4d7f45d1cf-57832a3e62amr524861a12.11.1716358424641; Tue, 21 May 2024 23:13:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716358424; cv=pass; d=google.com; s=arc-20160816; b=UxCuZKIjKh7HOYgRGI6wca3IIoiWJkS+Mi7VCf0ou/KkzoTZwZ62G1UmpKrCicT+PR aXLGt2PlIM20nxOoxKw41rq2yZ7rTjKA6ksf4aNRrQuq6p4AqDejlOipMR2PfKp40vic PDG6CLuBDlP3GvvgjsyTGh6+FNyNlwliiBJXY38+dukHp9yq6o77jXcMEr7tpqobT8pg C+A0puyPCZmFhuYL98q0fb8h5j3Qw3e2qgG2laeI9wjfMo0JbRlFyapnakRymMLRxBv4 MxZDPVgdGjPOcBS1Dn1bbInuS1SDoWm88l2+nPaWRUv63396o9I+sOWd7YuDldHfbdaU xhRA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=+clcXfgLVBiQX5MySmBhLxW05UlCMsdDj9QlU2/Rreg=; fh=ZaPvTvk3greVAhtlw/faBL7y/bcze5JBULOYO1tsevI=; b=oFA8Uz94b+zz1Xt8/y+64U+GWaRVTR4DxgqaV2x8Lvz0sj/48y1GfZi/SBrnbTf6Bd 339jg/Wx7R2hLH9GAeBUczbJ1lSGPcfkDqh+nSCV0iJnchl1SZqr/AyqaOR9+N9Y6El0 m5C9SwH2roaBb7CEaQjix9oLuV6TTFhpiuqUKWrs/jcYV+FAP9HJa21fbVRD8cl9lzN9 plZs85+8O34iQ78kSgKOBlABV0Yymw/tJmiyJHcB0mryZpsEMce2Xmmugl8k8WaOBB56 L5Jl1B+9lq8oyQu/k4XdUI5iFYdpvGFdiYwPcDN7HRn6/8v4Kvz9/zjzSjsrrcAa0nae D3Gg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@antgroup.com header.s=default header.b=ZjKPR4ec; arc=pass (i=1 spf=pass spfdomain=antgroup.com dkim=pass dkdomain=antgroup.com dmarc=pass fromdomain=antgroup.com); spf=pass (google.com: domain of linux-kernel+bounces-185798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185798-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5733c3777e0si15002482a12.605.2024.05.21.23.13.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 23:13:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-185798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@antgroup.com header.s=default header.b=ZjKPR4ec; arc=pass (i=1 spf=pass spfdomain=antgroup.com dkim=pass dkdomain=antgroup.com dmarc=pass fromdomain=antgroup.com); spf=pass (google.com: domain of linux-kernel+bounces-185798-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-185798-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 5C0B91F226F3 for ; Wed, 22 May 2024 06:13:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BB5807868B; Wed, 22 May 2024 06:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="ZjKPR4ec" Received: from out0-217.mail.aliyun.com (out0-217.mail.aliyun.com [140.205.0.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFDDF757E3 for ; Wed, 22 May 2024 06:13:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.217 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716358412; cv=none; b=Gru15+7GMszZ/AcwVNljsJWLAFM6tpXArmIxxAjij8CQDLAUno28yqEiKslQ3BD11AXJw7J9N4yucM3nmiTpc0aQLHJKTFMR7h1PIW5IOQ8LpiUUi1nAXaGrCBoP63XL5Bmww3BKSa/b8GlJhrK3Zcaq8qqT/DrcGOEE6mjSlvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716358412; c=relaxed/simple; bh=1gwBS5Cq9Mt+mBuCChuoPiJyX6uoYGfOwAsbB/VA+Ro=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Xqc98aqdES0poOivGW8DTg+7eq6r1tmKcwa97yuKi6CHhEhILHSBmvBGyChoSsj3kgEafYbMKeSYc3J096iFzlZ6hjULyemK2JVwdxQLhRzuGRRVz9VXsU092Vgin3PjIxRrooA2nFY9SVjzVKXwgi0C5TeSM0he0QEY2s4/a0o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com; spf=pass smtp.mailfrom=antgroup.com; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b=ZjKPR4ec; arc=none smtp.client-ip=140.205.0.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=antgroup.com; s=default; t=1716358407; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=+clcXfgLVBiQX5MySmBhLxW05UlCMsdDj9QlU2/Rreg=; b=ZjKPR4ecna7g4lVxy83K70sx+gDSrYJadj0Zhc7uYD23/TFA730XJ6LPbtUDMG788r8d06230EUxvjtthztl5IgEoJnae68wmvjfZyXJCu1AuWWcr++rUC4qRojStwqafw33vMoPKe1Yw7DO/T9lT/PAD0UJvjHvjQiHHdtKA5M= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R851e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045129160;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.Xk0LCMY_1716358405; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.Xk0LCMY_1716358405) by smtp.aliyun-inc.com; Wed, 22 May 2024 14:13:26 +0800 From: "Bang Li" To: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com Cc: , , , , , , , , "Bang Li" Subject: [PATCH v4 3/3] mm: Use update_mmu_tlb_range() to simplify code Date: Wed, 22 May 2024 14:12:04 +0800 Message-Id: <20240522061204.117421-4-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240522061204.117421-1-libang.li@antgroup.com> References: <20240522061204.117421-1-libang.li@antgroup.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Let us simplify the code by update_mmu_tlb_range(). Reviewed-by: Lance Yang Acked-by: David Hildenbrand Signed-off-by: Bang Li --- mm/memory.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index b5453b86ec4b..1297474546d6 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4416,7 +4416,6 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) vm_fault_t ret = 0; int nr_pages = 1; pte_t entry; - int i; /* File mapping without ->vm_ops ? */ if (vma->vm_flags & VM_SHARED) @@ -4486,8 +4485,7 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) update_mmu_tlb(vma, addr, vmf->pte); goto release; } else if (nr_pages > 1 && !pte_range_none(vmf->pte, nr_pages)) { - for (i = 0; i < nr_pages; i++) - update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pte + i); + update_mmu_tlb_range(vma, addr, vmf->pte, nr_pages); goto release; } -- 2.19.1.6.gb485710b