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 79F15C4332F for ; Wed, 8 Nov 2023 10:14:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F0DEB8D00B6; Wed, 8 Nov 2023 05:13:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EBA2C8D00AD; Wed, 8 Nov 2023 05:13:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DA9C68D00B6; Wed, 8 Nov 2023 05:13:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id CACD58D00AD for ; Wed, 8 Nov 2023 05:13:59 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8C25640A81 for ; Wed, 8 Nov 2023 10:13:59 +0000 (UTC) X-FDA: 81434376198.11.A8CDE0E Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf26.hostedemail.com (Postfix) with ESMTP id EA4EC140024 for ; Wed, 8 Nov 2023 10:13:56 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=UFiQLvmS; spf=none (imf26.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1699438437; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=2h5F5cEqywAQejXftRJY11d82vM8zMGKqSMTRf5CE1g=; b=M52biqBlDbVR0Xp9H8EnDxL/oZrGu8DDeOnQcLhar+uU/uvWFVNYrAGbBdI9Dndl4JRXBj nAIIPQljLfSJwru7DZgUZ0g7A79arU5xHJiDPUCVNNe1i7hEJUudcNiV2FUCUu5dm7a4yS wFpU0ojaycEWmLooidE6N7UEIiA3A7M= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699438437; a=rsa-sha256; cv=none; b=v8Tg3xsPZzWFRK3rvankVuF9PNocLtkZ2UYu6Xe20vxb+kXsdiirk9XCQjrbDEBvSeBkA7 QiPT44ShxIZhFR521eURw80p+N1OXaw7vO+O3WgBLD/EQIsvHbZMNgwWPtsILrNqHk164K NQqq9erFomgRCQWDMHK7TnUNuUHWzck= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=UFiQLvmS; spf=none (imf26.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=peterz@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=2h5F5cEqywAQejXftRJY11d82vM8zMGKqSMTRf5CE1g=; b=UFiQLvmS4+Gx8p6q0/VylFwpkR gAZnD7BP2yOefLqEVD/mEF0J6cpnr/kK5A6SDPZyNJshyNEEMmwywe78YxjlFSlXFEXZUkQ/FTexc Qj163Z4gt8LbS3U4q6FZF7GDfMqT+EG18J7RAI0nUgsHgnPbbWvXQ/Xi+bO2HmF7S9S1eRrWCGzTA WnEsqJopdy1UuNwVEBd+5u+LoyrjDGJt8zXt3Cnky9HRB9K85QaP94yPU+uHsNO6xlVBMj97ccmaN X56maLqZf8UjyyOb24fS0is8nfuK0Cc84W7nzbdw9QvRQNRUh7489ghUynDeQeRStOmjYO+rRYz2Q MAEdip3w==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1r0fYw-000OYq-OK; Wed, 08 Nov 2023 10:13:31 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 1A45F30049D; Wed, 8 Nov 2023 11:13:31 +0100 (CET) Date: Wed, 8 Nov 2023 11:13:30 +0100 From: Peter Zijlstra To: Ankur Arora Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, 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, David.Laight@aculab.com, richard@nod.at, mjguzik@gmail.com Subject: Re: [RFC PATCH 00/86] Make the kernel preemptible Message-ID: <20231108101330.GK3818@noisy.programming.kicks-ass.net> References: <20231107215742.363031-1-ankur.a.arora@oracle.com> <20231108085156.GD8262@noisy.programming.kicks-ass.net> <87bkc4lfxp.fsf@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87bkc4lfxp.fsf@oracle.com> X-Stat-Signature: 7icx7b4fmncppaii56bexmq4h6ijw4gb X-Rspamd-Server: rspam10 X-Rspamd-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U6iyUzXm/b+eVCUWOKuUBBuQXpt1PBAwy9EM3qnHO2F5XmNPFEx6Iww0eOaHHw/5Ra1TlRMCUnzbNCH7SJrWS8o0bYwegYKCxawKh/dP3+c0= 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: On Wed, Nov 08, 2023 at 02:04:02AM -0800, Ankur Arora wrote: > >> Revert "riscv: support PREEMPT_DYNAMIC with static keys" > >> Revert "livepatch,sched: Add livepatch task switching to > >> cond_resched()" > >> Revert "arm64: Support PREEMPT_DYNAMIC" > >> Revert "sched/preempt: Add PREEMPT_DYNAMIC using static keys" > > What's the best way to handle these? With the lazy bit, cond_resched() > and might_resched() are gone. So we don't need all of the static > key inftrastructure for toggling etc. > > The part of preempt_dynamic that makes sense to me is the one that > switches dynamically between none/voluntary/full. Here it would need > to be wired onto controls of the lazy bit. > (Right now the preemption policy is controlled by sched_feat in > patches 43, and 44 but sched/preempt is a much better interface.) I'm not understanding, those should stay obviously. The current preempt_dynamic stuff has 5 toggles: /* * SC:cond_resched * SC:might_resched * SC:preempt_schedule * SC:preempt_schedule_notrace * SC:irqentry_exit_cond_resched * * * NONE: * cond_resched <- __cond_resched * might_resched <- RET0 * preempt_schedule <- NOP * preempt_schedule_notrace <- NOP * irqentry_exit_cond_resched <- NOP * * VOLUNTARY: * cond_resched <- __cond_resched * might_resched <- __cond_resched * preempt_schedule <- NOP * preempt_schedule_notrace <- NOP * irqentry_exit_cond_resched <- NOP * * FULL: * cond_resched <- RET0 * might_resched <- RET0 * preempt_schedule <- preempt_schedule * preempt_schedule_notrace <- preempt_schedule_notrace * irqentry_exit_cond_resched <- irqentry_exit_cond_resched */ If you kill voluntary as we know it today, you can remove cond_resched and might_resched, but the remaining 3 are still needed to switch between NONE and FULL. Additionally, you'll get one new state to enable/disable the LAZY stuff. Neither NONE nor FULL want the LAZY thing on. You'll then end up with something like: /* * SK:preempt_lazy * SC:preempt_schedule * SC:preempt_schedule_notrace * SC:irqentry_exit_cond_resched * * * NONE: * preempt_lazy <- OFF * preempt_schedule <- NOP * preempt_schedule_notrace <- NOP * irqentry_exit_cond_resched <- NOP * * VOLUNTARY: * preempt_lazy <- ON * preempt_schedule <- preempt_schedule * preempt_schedule_notrace <- preempt_schedule_notrace * irqentry_exit_cond_resched <- irqentry_exit_cond_resched * * FULL: * preempt_lazy <- OFF * preempt_schedule <- preempt_schedule * preempt_schedule_notrace <- preempt_schedule_notrace * irqentry_exit_cond_resched <- irqentry_exit_cond_resched */ For the architectures that do not have static_call but instead use static_key for everything, the SC's are obviously static_key based wrappers around the function calls -- like now.