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 C8DC4C4332F for ; Wed, 8 Nov 2023 09:43:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 576888D00B1; Wed, 8 Nov 2023 04:43:22 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5263E8D00AD; Wed, 8 Nov 2023 04:43:22 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3C7218D00B1; Wed, 8 Nov 2023 04:43:22 -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 292F08D00AD for ; Wed, 8 Nov 2023 04:43:22 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EDFBB120898 for ; Wed, 8 Nov 2023 09:43:21 +0000 (UTC) X-FDA: 81434299002.05.A36ACF0 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by imf09.hostedemail.com (Postfix) with ESMTP id 1151F14001C for ; Wed, 8 Nov 2023 09:43:17 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com; dmarc=pass (policy=none) header.from=aculab.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699436599; 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=67x0WpZ/LW7n9xgO7kCjcFugxRqeSC6hHBDkraSO//g=; b=24hbgs2BY9+kc7rMHL3qCfXEt/ZanJyjaKif2fN+sx7djjKJ2CAH4hdwMijlIi2QzTQDv8 3huyoi5yfJu8Lc/zyZGg6lM5Ze3/4/1NE8n3zujCSNnktmHgH+EPUX2Ey8VsS6IMW5CkFj 6d1vH+cpkMQD3xXO5foNOAIz0mGXS1c= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=none; spf=pass (imf09.hostedemail.com: domain of david.laight@aculab.com designates 185.58.85.151 as permitted sender) smtp.mailfrom=david.laight@aculab.com; dmarc=pass (policy=none) header.from=aculab.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699436599; a=rsa-sha256; cv=none; b=me3jtyokhr7ydgsRIILD1xrmaxXO31vZKGXyRWo9zEhOQ/YQN3MgUyEzXJrxkAa5pycXhP 3KPC+BVrteMTBZJxZqjgOfpw4V4ja4Fnbeb7Y/Fj/j0EIoZbxKnLpXMuMcffD8rrJ2Lq08 oheKO7T10fB/WIQWwdywlQJ82MjNdY8= 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-92-DdS4nnRLMYe9zZNvc1xynA-1; Wed, 08 Nov 2023 09:43:13 +0000 X-MC-Unique: DdS4nnRLMYe9zZNvc1xynA-1 Received: from AcuMS.Aculab.com (10.202.163.4) by AcuMS.aculab.com (10.202.163.4) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 8 Nov 2023 09:43:10 +0000 Received: from AcuMS.Aculab.com ([::1]) by AcuMS.aculab.com ([::1]) with mapi id 15.00.1497.048; Wed, 8 Nov 2023 09:43:10 +0000 From: David Laight To: 'Ankur Arora' , "linux-kernel@vger.kernel.org" CC: "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" , "rostedt@goodmis.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+rBwJNlw Date: Wed, 8 Nov 2023 09:43:10 +0000 Message-ID: References: <20231107215742.363031-1-ankur.a.arora@oracle.com> In-Reply-To: <20231107215742.363031-1-ankur.a.arora@oracle.com> 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-Queue-Id: 1151F14001C X-Rspam-User: X-Stat-Signature: koc1dpkzt4rgesj4kbre6kq4hre47e7s X-Rspamd-Server: rspam01 X-HE-Tag: 1699436597-341836 X-HE-Meta: U2FsdGVkX18Ag41kxGG1IOTtLC88CK7lPwV+3SwInDH6jQ68Vi3vub2UBbY5ERF9H7z5/9oDgvuBmDvz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vLRpp7Y+6FSYRiaNArunLm/jHl6zSKc24TpvPD9CnE960aM/oNqdJIDk6gDS/dtZNAGaNrzFgn8yRnbMl1VaNJFO5oMnknjc= 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: Ankur Arora > Sent: 07 November 2023 21:57 ... > There are four main sets of preemption points in the kernel: >=20 > 1. return to user > 2. explicit preemption points (cond_resched() and its ilk) > 3. return to kernel (tick/IPI/irq at irqexit) > 4. end of non-preemptible sections at (preempt_count() =3D=3D preempt_of= fset) >=20 ... > Policies: >=20 > A - preemption=3Dnone: run to completion > B - preemption=3Dvoluntary: run to completion, unless a task of higher > sched-class awaits > C - preemption=3Dfull: optimized for low-latency. Preempt whenever a high= er > priority task awaits. If you remove cond_resched() then won't both B and C require an extra IPI. That is probably OK for RT tasks but could get expensive for normal tasks that aren't bound to a specific cpu. 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. Certainly it should all help the scheduling of RT tasks - which can currently get delayed by a non-RT task in a slow kernel path. Although the worst one is the softint code... =09David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1= PT, UK Registration No: 1397386 (Wales)