Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2499129lqo; Mon, 20 May 2024 07:45:25 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWny1NaZYpKZHOQSiqC1VdYL08H4ZKvQrudC0wWKSJwxeFUNSH1lEy9x2i2APjRWqK2L3hns5pizhJyURPhUIJt+owb+7n4R2Vc7e00dw== X-Google-Smtp-Source: AGHT+IHBif3dxEv83bBxOOQwLAnlszrk+Bh9ZyXZL3P5N0PTCePtaGBuuZpn0ILMmtKUqRikMi37 X-Received: by 2002:a17:907:7e89:b0:a61:b2ab:438b with SMTP id a640c23a62f3a-a61b2ab46c8mr174953166b.22.1716216325606; Mon, 20 May 2024 07:45:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716216325; cv=pass; d=google.com; s=arc-20160816; b=yYtEz8mQmdFeneQ4hmJHgmEeNnR7Vxv8ebapJIe+eq1KJ1cgZwKdqkAyLp0Bp0cJyT KZ4GdpfelZDwJtE2Cj+dtAUo7JC26B/AWLbEVh2Zt25kGpXLtG/WHIzfaRT/sTB/XAYU b3UG7NkYuJKg+dshvbRGXVr7zcTSIrq0AlgZYEpdSuLFH1fcCciR4kGGtbxeumPtYh5L 0fMPmvT2DvBxGLMbWebij+AvL7pdKRl/kCDVYCeug1sp2d1sLP5Aq2fBf7Vost2bFBRI Y8tSAoE+uQgPOSVwIHDPydFkMdIXmRGQ3mSRN96FsY/wfzZajObAS4xjVCdYXchsRcpb +I5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=LeSLRL0OKsRhD4qQFOfBvy1JJv4XgJp3PPoxz2ixx5E=; fh=Cbi+3w6nelRbNen6ohqCsvXf19OhF3/ySpsBrNpl2VY=; b=HzS12M7wMP/JnYZ9Dj5Xx8O7OycklYZzqu04EGrCNL4eq/dwjxVXfB3LtMiVh1vrXC 1pbrZd1/FPskuJTaR4bZMct+PPsxQjrw0SoPAib1Kk7rWsONvQ3nAcnMSDzd5DSD4wUX AEnGUmznE+IZ7ot24n5zPvWbaDanX4M0hUAH2n5lm2b9Pgco1lDgq+aOp7uniZZJ6skd NPGSQLtXmFyNMYpC8gheWO9F8AgAk3ou+XFa567WUJfXWIOBaPPldkM/XnbT+gPaIGs3 JObZ+3IJ9B6MfsnyleeVi4VXLb47y7bxeLNwzaK6cpXdDK3AsJOVELYpYRsMvn3xqNkm 8GOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=AcA28TtJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-183855-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183855-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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-a5a17bfff56si1375516366b.879.2024.05.20.07.45.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 07:45:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-183855-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=@gmail.com header.s=20230601 header.b=AcA28TtJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-183855-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-183855-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 57A7A1F22078 for ; Mon, 20 May 2024 14:45:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6ABCB13699B; Mon, 20 May 2024 14:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AcA28TtJ" Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34DD48462 for ; Mon, 20 May 2024 14:45:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716216317; cv=none; b=N6A9yD7l71ezQ+1qKvxLm+n1RONELogHsLUiAONP/5FLZNfSAa7jY8Jnzf9umMM69iDqHr3i4pGvTmbLf544vgLoGdcMSuSk09yjRMH1Sxa+oCLyG1qschmHexHSlYMVKvKXThjtKDOj5vudUX5Wgw0IPFjZYzQD25LLmV7w0/8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716216317; c=relaxed/simple; bh=eBqFY/TIoMgxP29NOdWtsaUl5FItN7otD1voKRBdwJQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=Uv4RFCo+Kpsphkt239xVMbx2+5SRHf/t+GuE6HHlBTOvYd2utZzaS6Nq3Aryz5KOWud9GWgmbtCiosxAbCQIj50ay7HyAmcWY7UHku1m/Fe5oS3W4ED6qzf30NLV6XoaNuOsHK4Ad6JROKIfqedFqHShyWl4a0lqb683WIS7I1g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=AcA28TtJ; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-56e6a1edecfso10532042a12.1 for ; Mon, 20 May 2024 07:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716216314; x=1716821114; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=LeSLRL0OKsRhD4qQFOfBvy1JJv4XgJp3PPoxz2ixx5E=; b=AcA28TtJ7BdaxEEHXOULkJDFWJ9a4UvPY9Iyfg7H4pqBNjPRMDU32cn8Bxlj9sh4Ul G55KeMtpg/sO94YTbVb/u0ttsOzSkPOqaH+hHma4dlaBmaCsMLtQB27gM5SScB/ZfBRq CJXWBCBVacD73pJwuOZMadG7HjUBhW0tTszOQ+5kxEyIN5jClkMCMY8nGjKuL4Z+9pzD Z5C12WCnw/UWUWzoASe+qDwhA3gJwhgv4o5QdMCUw9ISbQyg48OA7mC/xoVSIBh0LTsp A/PZKG3ZwPwdpaV93JDAcdkBm+nC5sOBpSmKtl0a8WD0wqDkOLRE15wnyAvStPnaWmwx 7sYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716216314; x=1716821114; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LeSLRL0OKsRhD4qQFOfBvy1JJv4XgJp3PPoxz2ixx5E=; b=DCEHJCBdeFXr90JDxtEW6ETSS8bH1l29vZi4QL6mV8Bavudpi944fSgZFoJ+yBfWud iTs+e6uNLqisrSzbHIKSv9jwTMvxUXyvIngsegRaFYul7yQ0p7nYz4p4z7ETq2wLdBnw wZu8BXuu1aj524zSVYf6IGc783r3Hp8I9pM83sAX36/8MubYBHTqPg7jEY12bivo9tqr ZsHMiBo381oWA16kQQQL9PZWMYMb2epWAbMcCu7liym983LZWEZG3gtjdMN+y6Aqi+AS nJ579OfRFtJWWAZwdRn57bSaBkYL1UkKs57y5U/Yt1joss6bKMYUcWBu6lxY1r4FcUPA NDgA== X-Forwarded-Encrypted: i=1; AJvYcCUgS7ZdVVPCYixpIEiCwk3rYQPFCeGzYCbR2qV1GbA4+ZxzZRfZ54OXT6uN2XkZS7H9YHLKmSskXxiZcWXxreMdR4kLYFFJI4JJYL1N X-Gm-Message-State: AOJu0YywuW4/p5xkTJ5Avoe9eTG3mRndbIOXCJMKuIa+/dahodZ2WKzA SZHBIFa6xC6MobgwWhRW31IdaL5oecOEL2e3/XoY0qBR5tjwmmnR7P5Vn5ARvfN4NDbMhrEM4qK TYD8RhYH+czfMTu+nS3QbE/QKYVs= X-Received: by 2002:a05:6402:3486:b0:574:ea61:3b01 with SMTP id 4fb4d7f45d1cf-574ea613b99mr13223033a12.16.1716216314505; Mon, 20 May 2024 07:45:14 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240518074914.52170-1-libang.li@antgroup.com> <20240518074914.52170-4-libang.li@antgroup.com> In-Reply-To: <20240518074914.52170-4-libang.li@antgroup.com> From: Lance Yang Date: Mon, 20 May 2024 22:45:02 +0800 Message-ID: Subject: Re: [PATCH v3 3/3] mm: Use update_mmu_tlb_range() to simplify code To: Bang Li Cc: akpm@linux-foundation.org, chenhuacai@kernel.org, tsbogend@alpha.franken.de, paul.walmsley@sifive.com, palmer@dabbelt.com, chris@zankel.net, jcmvbkbc@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, loongarch@lists.linux.dev, linux-riscv@lists.infradead.org, david@redhat.com, ryan.roberts@arm.com, libang.linux@gmail.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sat, May 18, 2024 at 3:51=E2=80=AFPM Bang Li wr= ote: > > Let us simplify the code by update_mmu_tlb_range(). > LGTM. Reviewed-by: Lance Yang > 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 =3D 0; > int nr_pages =3D 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 =3D 0; i < nr_pages; i++) > - update_mmu_tlb(vma, addr + PAGE_SIZE * i, vmf->pt= e + i); > + update_mmu_tlb_range(vma, addr, vmf->pte, nr_pages); > goto release; > } > > -- > 2.19.1.6.gb485710b >