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 BA0D7C4167B for ; Wed, 8 Nov 2023 16:29:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 37A6B8D00BD; Wed, 8 Nov 2023 11:29:55 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 304558D0073; Wed, 8 Nov 2023 11:29:55 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1CC708D00BD; Wed, 8 Nov 2023 11:29:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0C52A8D0073 for ; Wed, 8 Nov 2023 11:29:55 -0500 (EST) Received: from smtpin29.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id D078B160434 for ; Wed, 8 Nov 2023 16:29:54 +0000 (UTC) X-FDA: 81435323508.29.CA6D11D Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by imf14.hostedemail.com (Postfix) with ESMTP id B482A100025 for ; Wed, 8 Nov 2023 16:29:50 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf14.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699460992; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fP4r4qQRXFlJWmw9mBEJiKgTVk8fOkuudEStXsDgNsU=; b=CLCWzonZ5viVm0nryPyqFfzTEDAzkl9fdkwvYsLanJFCO4J1ywMosOgKX+espJyEzoonKy XRfi9k+gkYepFSB6pJRiPwnhjTDwDlzea58001WKryuWkeyeBlDHpX3kcHboW5VtiJ8WE3 l0hnefdsIxYiBO8LibeUAEKnmUc7xsk= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=aculab.com; spf=pass (imf14.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699460992; a=rsa-sha256; cv=none; b=aX+ZWGkXvVJEjC3fBDwzkyckmoSfdJurKf1PDNVw0zU8VxLhrOPZtTZo1gRwD/wJUWh7Oa zwq/I1SHUYpV704cgKi6koYLbf1CdIRFvm12dksPnMZQvqRhj7o4Ik3TiUd+bnHNbzgKFQ tPncGp08y8bKPbEK+jamN7Nq2Xu41ks= Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with both STARTTLS and AUTH (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-202-TeiFwQDsO6-x3H0sA3xebA-1; Wed, 08 Nov 2023 16:29:45 +0000 X-MC-Unique: TeiFwQDsO6-x3H0sA3xebA-1 Received: from AcuMS.Aculab.com (10.202.163.6) by AcuMS.aculab.com (10.202.163.6) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 8 Nov 2023 16:29:40 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 8 Nov 2023 16:29:40 +0000 From: David Laight To: 'Steven Rostedt' CC: 'Ankur Arora' , "linux-kernel@vger.kernel.org" , "tglx@linutronix.de" , "peterz@infradead.org" , "torvalds@linux-foundation.org" , "paulmck@kernel.org" , "linux-mm@kvack.org" , "x86@kernel.org" , "akpm@linux-foundation.org" , "luto@kernel.org" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , "mingo@redhat.com" , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "willy@infradead.org" , "mgorman@suse.de" , "jon.grimm@amd.com" , "bharata@amd.com" , "raghavendra.kt@amd.com" , "boris.ostrovsky@oracle.com" , "konrad.wilk@oracle.com" , "jgross@suse.com" , "andrew.cooper3@citrix.com" , "mingo@kernel.org" , "bristot@kernel.org" , "mathieu.desnoyers@efficios.com" , "geert@linux-m68k.org" , "glaubitz@physik.fu-berlin.de" , "anton.ivanov@cambridgegreys.com" , "mattst88@gmail.com" , "krypton@ulrich-teichert.org" , "richard@nod.at" , "mjguzik@gmail.com" Subject: RE: [RFC PATCH 00/86] Make the kernel preemptible Thread-Topic: [RFC PATCH 00/86] Make the kernel preemptible Thread-Index: AQHaEcV0+BoURT5JbUqhFq41r7bm+rBwJNlwgABkiACAAAiUQA== Date: Wed, 8 Nov 2023 16:29:40 +0000 Message-ID: <19a53508f44049a39272e5bd89ade4ab@AcuMS.aculab.com> References: <20231107215742.363031-1-ankur.a.arora@oracle.com> <20231108101552.7ebbb52d@gandalf.local.home> In-Reply-To: <20231108101552.7ebbb52d@gandalf.local.home> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: B482A100025 X-Stat-Signature: ifuarfm6uq8nhowqy7zc3pxc5hjs7pfp X-Rspam-User: X-HE-Tag: 1699460990-986692 X-HE-Meta: U2FsdGVkX19GpWZuLwqpCa/yue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PxeFpNnkaxShSlm99NIVCM2uuFCh8Kpp8XwHUQND+dQjSlQAlh0NNU18hTaTWHEmrV9ovDxY+yABkk8F2xkC4tqF0xg7CY2GNFeJ6Xx2wvTHxDNN0DxRkX7zFd8Jf9wiKRxS/duGunPRiQs0puKPh6KOtb8Uef/lkL+a+vO2peDmbSo= 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: List-Subscribe: List-Unsubscribe: From: Steven Rostedt > Sent: 08 November 2023 15:16 >=20 > On Wed, 8 Nov 2023 09:43:10 +0000 > David Laight wrote: >=20 > > > Policies: > > > > > > A - preemption=3Dnone: run to completion > > > B - preemption=3Dvoluntary: run to completion, unless a task of highe= r > > > sched-class awaits > > > C - preemption=3Dfull: optimized for low-latency. Preempt whenever a = higher > > > priority task awaits. > > > > If you remove cond_resched() then won't both B and C require an extra I= PI. > > That is probably OK for RT tasks but could get expensive for > > normal tasks that aren't bound to a specific cpu. >=20 > What IPI is extra? I was thinking that you wouldn't currently need an IPI if the target cpu was running in-kernel because nothing would happen until cond_resched() was called. > > I suspect C could also lead to tasks being pre-empted just before > > they sleep (eg after waking another task). > > There might already be mitigation for that, I'm not sure if > > a voluntary sleep can be done in a non-pre-emptible section. >=20 > No, voluntary sleep can not be done in a preemptible section. I'm guessing you missed out a negation in that (or s/not/only/). I was thinking about sequences like: =09wake_up(); =09... =09set_current_state(TASK_UNINTERRUPTIBLE) =09add_wait_queue(); =09spin_unlock(); =09schedule(); Where you really don't want to be pre-empted by the woken up task. For non CONFIG_RT the lock might do it - if held long enough. Otherwise you'll need to have pre-emption disabled and enable it just after the set_current_state(). And then quite likely disable again after the schedule() to balance things out. So having the scheduler save the pre-empt disable count might be useful. =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)