Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1392042lqo; Sat, 18 May 2024 00:52:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVcQ7Ib+ezby47cCCOTXGwdni1q0fSrNS9qVCNn3u2+vz3lw1YDGYx3umP4pC+Ps7qmTDPjgH7JVmLoUEZH7LgTX6tpYzSZf7jjKrdp9Q== X-Google-Smtp-Source: AGHT+IHxy0Qn8URKoygdn3cMYqhmOAHKPq8uB4k4bW37fZcjIj8uVksW/YvTYuRW+Xoy7hBFqni6 X-Received: by 2002:a17:907:20e5:b0:a59:c345:17fb with SMTP id a640c23a62f3a-a5d58d54c90mr99901466b.5.1716018725089; Sat, 18 May 2024 00:52:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716018725; cv=pass; d=google.com; s=arc-20160816; b=c6vchp+C3dnK65knUi5dfxS1ruESgOG53LfxPqVhCt+ReQ+deFRdNgiKIHBzAxuJvH LTSl/MwbbEIUqbuhI4I0zAionFs59vPKGD+11Py9rYWsp4V2JwnNGlrWvD3oe86qSYlM IgL1cn61QZuqp5nNySmWo2h105seG4ykVYqP6NuVzwAJHTPnnyvd69EKNh/0WtIJL9YW sq6fbMspclOITP6KkSF5kyI3V/uwO1IJHP76+YAgyMLUGAY6eeGt+vyiTJFhP7ck8sxa JvZUk+aC7co5X1lgjuhEU4CNB/zgsT0XF44zQmAj7nmP1CxBgxcLVDrmPaFrjMPj3pnE BJ2g== 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=MvaQlNmLKjB1JJG125kcLMl74RVFk5etnjUBr5sySWs=; fh=ZaPvTvk3greVAhtlw/faBL7y/bcze5JBULOYO1tsevI=; b=rkNCrqUYKQ9rikanNrsDeBO98hrOPdevLEvpO9PpPfFKqZcZudIw8Xn0QOISpx7AqR pmI8JagsdFeMNLush36WibAJTaoJaopUrH0dj+qQ/r+qtEeQBK89l/ZZHZOadvm9vc2X WY4WxL8QcOV9ydMmz8vnfNl4ODna+ytiKAbkakEYBINZ38TfaeonZJ05oIMbHR4URdXb AWDRtjPT/qllhkzsMXvZywHJiOyzZwdbTh1KX79fnjf27ittDaGDN6TL3I2UWuUv4eiS HhLFJ2maOPcRImlV9Wj2n6+T79UGptkvnBUNyluiydMyTFIybN9JsRVPwsORfFQrnOmD 9Q6g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@antgroup.com header.s=default header.b=0IlDP5wf; 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-182792-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182792-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 a640c23a62f3a-a5a17b20ee3si1052558266b.391.2024.05.18.00.52.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 18 May 2024 00:52:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182792-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=0IlDP5wf; 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-182792-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182792-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 CC2491F2181C for ; Sat, 18 May 2024 07:52:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B9AF011185; Sat, 18 May 2024 07:51:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=antgroup.com header.i=@antgroup.com header.b="0IlDP5wf" Received: from out0-198.mail.aliyun.com (out0-198.mail.aliyun.com [140.205.0.198]) (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 9799BC8D1 for ; Sat, 18 May 2024 07:51:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.205.0.198 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716018711; cv=none; b=WXsakBZJFJ32Xk3nDzR54LEuVOacdQDUdUMRPuPwmVDkE2s8ZIHlnIzWQSTg9sPybUIXoJZ5FgPhkNd1WZhHJn0S5Bt+Mu9HaFiVvC8Fq95M57ggceMg0BWYhZysT9LomG30fE9T5jTZkK+YtD4JXa31tcXrlMsk8lbiD25GIok= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716018711; c=relaxed/simple; bh=ezZZUjXre2eUUn/DDsHxMohnuZJYrK0JL7K6dgq80Rs=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=oycQXBCJ+iJsoLRdh0bfbBm6RKXL4kXw03KaTo1zA96trH98l9BrCXVcE6COfJzafuOOHGs4QlQR5lU5edqdgxiKC/c1akk+e6flvlTAJjFcDLuHOMVrhEtyl9Put9LLY8Gu36sgjvfu22xuDGiT0gTgIcljwJwniONH+5T9dS0= 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=0IlDP5wf; arc=none smtp.client-ip=140.205.0.198 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=1716018701; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=MvaQlNmLKjB1JJG125kcLMl74RVFk5etnjUBr5sySWs=; b=0IlDP5wf+f6nRHb1uwC+DFTFkgr5wFHSQYK4a1lx22LkveOy8pulAeT3912AVIHSp9Tjjc+Bw2N9xd9zDmN4on1gERrUMinmxDE4eSSEERoUJ4ukg0bQSOI3MQea0c9x1tjJll3Bt2njP95WC6xagfRKhzy5flJ1RxmMkepXcrU= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R771e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047203;MF=libang.li@antgroup.com;NM=1;PH=DS;RN=16;SR=0;TI=SMTPD_---.XgA9uMj_1716018698; Received: from localhost(mailfrom:libang.li@antgroup.com fp:SMTPD_---.XgA9uMj_1716018698) by smtp.aliyun-inc.com; Sat, 18 May 2024 15:51:39 +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 v3 3/3] mm: Use update_mmu_tlb_range() to simplify code Date: Sat, 18 May 2024 15:49:14 +0800 Message-Id: <20240518074914.52170-4-libang.li@antgroup.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20240518074914.52170-1-libang.li@antgroup.com> References: <20240518074914.52170-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(). 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 eea6e4984eae..2d53e29cf76e 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4421,7 +4421,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) @@ -4491,8 +4490,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