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 X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4CCE6C388F9 for ; Thu, 19 Nov 2020 09:38:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C61702469D for ; Thu, 19 Nov 2020 09:38:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C61702469D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2766D6B005C; Thu, 19 Nov 2020 04:38:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1FEC56B005D; Thu, 19 Nov 2020 04:38:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0A1E96B0068; Thu, 19 Nov 2020 04:38:39 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0208.hostedemail.com [216.40.44.208]) by kanga.kvack.org (Postfix) with ESMTP id C3F2B6B005C for ; Thu, 19 Nov 2020 04:38:39 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6AAC41EE6 for ; Thu, 19 Nov 2020 09:38:39 +0000 (UTC) X-FDA: 77500667958.17.care86_520eb5527341 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 4DAFC180D0180 for ; Thu, 19 Nov 2020 09:38:39 +0000 (UTC) X-HE-Tag: care86_520eb5527341 X-Filterd-Recvd-Size: 4921 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Thu, 19 Nov 2020 09:38:38 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A2886AC59; Thu, 19 Nov 2020 09:38:37 +0000 (UTC) Date: Thu, 19 Nov 2020 09:38:34 +0000 From: Mel Gorman To: Thomas Gleixner Cc: LKML , x86@kernel.org, Linus Torvalds , Christoph Hellwig , Matthew Wilcox , Daniel Vetter , Andrew Morton , linux-mm@kvack.org, Peter Zijlstra , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Daniel Bristot de Oliveira , Linus Torvalds Subject: Re: [patch V4 4/8] sched: Make migrate_disable/enable() independent of RT Message-ID: <20201119093834.GH3306@suse.de> References: <20201118194838.753436396@linutronix.de> <20201118204007.269943012@linutronix.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HcAYCG3uE/tztfnV" Content-Disposition: inline In-Reply-To: <20201118204007.269943012@linutronix.de> User-Agent: Mutt/1.10.1 (2018-07-13) 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: --HcAYCG3uE/tztfnV Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 18, 2020 at 08:48:42PM +0100, Thomas Gleixner wrote: > From: Thomas Gleixner >=20 > Now that the scheduler can deal with migrate disable properly, there is no > real compelling reason to make it only available for RT. >=20 > There are quite some code pathes which needlessly disable preemption in > order to prevent migration and some constructs like kmap_atomic() enforce > it implicitly. >=20 > Making it available independent of RT allows to provide a preemptible > variant of kmap_atomic() and makes the code more consistent in general. >=20 > FIXME: Rework the comment in preempt.h - Peter? >=20 I didn't keep up to date and there is clearly a dependency on patches in tip for migrate_enable/migrate_disable . It's not 100% clear to me what reworking you're asking for but then again, I'm not Peter! =46rom tip; /** * migrate_disable - Prevent migration of the current task * * Maps to preempt_disable() which also disables preemption. Use * migrate_disable() to annotate that the intent is to prevent migration, * but not necessarily preemption. * * Can be invoked nested like preempt_disable() and needs the corresponding * number of migrate_enable() invocations. */ I assume that the rework is to document the distinction between migrate_disable and preempt_disable() because it may not be clear to some people why one should be used over another and the risk of cut&paste cargo cult programming. So I assume the rework is for the middle paragraph * Maps to preempt_disable() which also disables preemption. Use * migrate_disable() to annotate that the intent is to prevent migration, * but not necessarily preemption. The distinction is that preemption * disabling will protect a per-cpu structure from concurrent * modifications due to preemption. migrate_disable partially protects * the tasks address space and potentially preserves the TLB entries * even if preempted such as an needed for a local IO mapping or a * kmap_atomic() referenced by on-stack pointers to avoid interference * between user threads or kernel threads sharing the same address space. I know it can have other examples that are rt-specific and some tricks on percpu page alloc draining that relies on a combination of migrate_disable and interrupt disabling to protect the structures but the above example might be understandable to a non-RT audience. --=20 Mel Gorman SUSE Labs --HcAYCG3uE/tztfnV Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEElcbIJ2qkxLDKryriKjSY26pIcMkFAl+2PRoACgkQKjSY26pI cMnvPgf8C0Rz6379u3SiizulY/2x+DGd943six/cqbAevyKsHg44fG6DLNobVUIY vzIcm+xG8K3Y6JoLem7YN05cIW8ex36spIKu3Efjc5f7jnrr+kpkJ4iM9M6P1o32 UnEXwAJrONi/DpJxyNT/oWhAsyvPiHam/XeOL+b6w6OuUclG4z/zWSVaWIoE1l6t kiTuAXrLRNeY7oUk4tWLd/eFSj+IqGB/te3+d/MO/rS4uKE6CArLpmvH0X/TcvGC su9aEnObX/kRphCpcAXH+DBaiVryoC1G8k6GQYhG6ymlksq3jNpfidB9zwsgJee8 KgH+bSJw22QhfZjni+fv63YXgTjpyQ== =600v -----END PGP SIGNATURE----- --HcAYCG3uE/tztfnV--