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 CE9FEC433F5 for ; Sun, 9 Jan 2022 19:37:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A5536B0071; Sun, 9 Jan 2022 14:37:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1557A6B0073; Sun, 9 Jan 2022 14:37:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01C1B6B0074; Sun, 9 Jan 2022 14:37:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id E6EEC6B0071 for ; Sun, 9 Jan 2022 14:37:27 -0500 (EST) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id A12419677C for ; Sun, 9 Jan 2022 19:37:27 +0000 (UTC) X-FDA: 79011757734.14.FDDDF22 Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) by imf15.hostedemail.com (Postfix) with ESMTP id ABB13A0014 for ; Sun, 9 Jan 2022 19:37:26 +0000 (UTC) Received: from imladris.surriel.com ([96.67.55.152]) by shelob.surriel.com with esmtpsa (TLS1.2) tls TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1n6e0I-0001Ru-12; Sun, 09 Jan 2022 14:37:22 -0500 Message-ID: <803a5d61426b149abf08e19759e086893e379382.camel@surriel.com> Subject: Re: [PATCH 16/23] sched: Use lightweight hazard pointers to grab lazy mms From: Rik van Riel To: Nadav Amit Cc: Linus Torvalds , Andy Lutomirski , Andrew Morton , Linux-MM , Nicholas Piggin , Anton Blanchard , Benjamin Herrenschmidt , Paul Mackerras , Randy Dunlap , linux-arch , X86 ML , Dave Hansen , Peter Zijlstra , Mathieu Desnoyers Date: Sun, 09 Jan 2022 14:37:21 -0500 In-Reply-To: <1B6896F0-7A51-4936-8B50-0B86551FA3B7@gmail.com> References: <7c9c388c388df8e88bb5d14828053ac0cb11cf69.1641659630.git.luto@kernel.org> <739A3109-04DD-4BA5-A02B-52EE30E820AE@gmail.com> <1B6896F0-7A51-4936-8B50-0B86551FA3B7@gmail.com> Content-Type: multipart/signed; micalg="pgp-sha256"; protocol="application/pgp-signature"; boundary="=-CP9cQdjxomTbAfjFq8L2" User-Agent: Evolution 3.40.3 (3.40.3-1.fc34) MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: ABB13A0014 X-Stat-Signature: pauiex8w1f4ruyb6r55hc4pjy7nd9jzk Authentication-Results: imf15.hostedemail.com; dkim=none; dmarc=none; spf=none (imf15.hostedemail.com: domain of riel@shelob.surriel.com has no SPF policy when checking 96.67.55.147) smtp.mailfrom=riel@shelob.surriel.com X-HE-Tag: 1641757046-679543 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: --=-CP9cQdjxomTbAfjFq8L2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, 2022-01-09 at 11:34 -0800, Nadav Amit wrote: >=20 >=20 > > On Jan 9, 2022, at 11:22 AM, Rik van Riel wrote: > >=20 > > On Sun, 2022-01-09 at 00:49 -0800, Nadav Amit wrote: > > >=20 > > > It is possible for instance to get rid of is_lazy, keep the CPU > > > on mm_cpumask when switching to kernel thread, and then if/when > > > an IPI is received remove it from cpumask to avoid further > > > unnecessary TLB shootdown IPIs. > > >=20 > > > I do not know whether it is a pure win, but there is a tradeoff. > >=20 > > That's not a win at all. It is what we used to have before > > the lazy mm stuff was re-introduced, and it led to quite a > > few unnecessary IPIs, which are especially slow on virtual > > machines, where the target CPU may not be running. >=20 > You make a good point about VMs. >=20 > IIUC Lazy-TLB serves several goals: >=20 > 1. Avoid arch address-space switch to save switching time and > =C2=A0=C2=A0 TLB misses. > 2. Prevent unnecessary IPIs while kernel threads run. > 3. Avoid cache-contention on mm_cpumask when switching to a kernel > =C2=A0=C2=A0 thread. >=20 > Your concern is with (2), and this one is easy to keep regardless > of the rest. >=20 > I am not sure that (3) is actually helpful, since it might lead > to more cache activity than without lazy-TLB, but that is somewhat > orthogonal to everything else. I have seen problems with (3) in practice, too. For many workloads, context switching is much, much more of a hot path than TLB shootdowns, which are relatively infrequent by comparison. Basically ASID took away only the first concern from your list above, not the other two. --=20 All Rights Reversed. --=-CP9cQdjxomTbAfjFq8L2 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iQEzBAABCAAdFiEEKR73pCCtJ5Xj3yADznnekoTE3oMFAmHbOXEACgkQznnekoTE 3oO8Ywf+I58H/vuvwuIGORyLNgDGBaVY2wJ+L0xT4qAxywlEGTVN9J77TVEftLeG 7BXqgNISqI7a6hIF70aToUS2MRmDBza/RmO4kWaq9ud1AvY36cJXlFbQVrAN9Kzl 7nlY0y4oXlZkiAL+7YluU+DicLHb/YIfmJ7xc82GlEBFiwK8Ld5mbHf0+Ezx8EoU X9NmQzW+l8QcPhCFBMLV5yQm+Vmk/Wb28kTRFsou6/jX4nFN9vWjnavXtP8uCECi ulYkol580vUFWsBvRu1sjj0u3jRJaQxqr3Awq38T1ANTfMxRAj0yt6N8rhX//5Tw 4i59n3ArphgQvhnytbp+VIvyGjySSQ== =T+Yp -----END PGP SIGNATURE----- --=-CP9cQdjxomTbAfjFq8L2--