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 4CBE2C4332F for ; Wed, 8 Nov 2023 09:58:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE9408D00B5; Wed, 8 Nov 2023 04:58:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D9A658D00AD; Wed, 8 Nov 2023 04:58:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C5FD48D00B5; Wed, 8 Nov 2023 04:58:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B669D8D00AD for ; Wed, 8 Nov 2023 04:58:40 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 945511CB842 for ; Wed, 8 Nov 2023 09:58:40 +0000 (UTC) X-FDA: 81434337600.16.EB6A7A7 Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) by imf14.hostedemail.com (Postfix) with ESMTP id D2B6110000E for ; Wed, 8 Nov 2023 09:58:38 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=jbnHMjVJ; spf=none (imf14.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) 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=1699437518; 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=sn3OfzVlyBbtRSdn9Yn/q14IvVXQuQu5C9ul2NWMZe8=; b=WUJW9HmM/MFCC104p9LLyjnIjIdU2WLLARkX4KD2DuZZdzc7kc0nhMhHTVgb0AjpNriRIm Zm7Pns9O1qtU2GYTS0mnTTtBY1zxt7LrPu0uUH4uqMXt42VcNJI6EQZak7+wQD7SFDI9Cg M240dr9JVoYfUSIa8kWe5Bp1yCgUl4I= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1699437518; a=rsa-sha256; cv=none; b=RrPqrQ6C+0I/FUr83q42AhYSr3OwEMNKGDzJfnFlZLqVnNgwmaAajl2+00u3n99T83uLXh vfegRxNAGkMI+SBPMyO79x5EUOCVlqrKWN1W6t2LHnqYGZ3FSYnckfQNsvMT6abRbSObF7 C9FUJ+wAp1tCqZKWtgCYzxk5WE5tO10= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=infradead.org header.s=desiato.20200630 header.b=jbnHMjVJ; spf=none (imf14.hostedemail.com: domain of peterz@infradead.org has no SPF policy when checking 90.155.92.199) smtp.mailfrom=peterz@infradead.org; dmarc=none DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=sn3OfzVlyBbtRSdn9Yn/q14IvVXQuQu5C9ul2NWMZe8=; b=jbnHMjVJNLD07fWvagwdbW+y70 4Yoh2EcQhAnGy6AFksbwjYn2h2WEAGSvctl7KqPkPc1uLjcpL9+SrhdE7Az0eSbtSyr7Wlrp3PMCc 4bgyle2kEk68Z3zkgujBK7anh+hIFIS2AEPMd/BAfkqrHSccVDnv0LP0ODbFv1lrPO/fEaqsYgwUj VYDTwmlFSBK1VeTDTiO8LtVQ0+dozDeFBkpVXhuHAdrkuo6pl9S8ncPEQ6JZyqj8kjZ1xcCE3qNeD L2KVaVwgFj/Zw+2oLfYDYXsuZlvqM4n9cXADOGypybuu21xZbB3ye09roXHNNqIwjv2f1vwcZQ5ee SGmm9jmg==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1r0fKC-00DOlL-1a; Wed, 08 Nov 2023 09:58:16 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 2C4DC30049D; Wed, 8 Nov 2023 10:58:16 +0100 (CET) Date: Wed, 8 Nov 2023 10:58:16 +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 43/86] sched: enable PREEMPT_COUNT, PREEMPTION for all preemption models Message-ID: <20231108095816.GN8262@noisy.programming.kicks-ass.net> References: <20231107215742.363031-1-ankur.a.arora@oracle.com> <20231107215742.363031-44-ankur.a.arora@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231107215742.363031-44-ankur.a.arora@oracle.com> X-Stat-Signature: mfb66c36pcj6o33npyst46ph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6M6cA0A y3RIb0gzkwcpyTEstZJ/thLeROkQMegyOz9fx8LB1cHm/zypkCdQPu7bNMqLH9vFnZ6L/7XcsJtUi5hLwJx+4hOuOIFBorrN8xMnmSufN5HL5azjrh9aHXY1P1truUu7SHNqv6SS1VaLOR9BLluJvWxa0jhMtwoOW7JxxFfsM3dESW08Ek7duRH8p+/SIj57dWc2HLLgMuwwHsQuChYGdxKB3eQ== 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 Tue, Nov 07, 2023 at 01:57:29PM -0800, Ankur Arora wrote: > The scheduler uses PREEMPT_COUNT and PREEMPTION to drive > preemption: the first to demarcate non-preemptible sections and > the second for the actual mechanics of preemption. > > Enable both for voluntary preemption models. > > In addition, define a new scheduler feature FORCE_PREEMPT which > can now be used to distinguish between voluntary and full > preemption models at runtime. > > Originally-by: Thomas Gleixner > Signed-off-by: Ankur Arora > --- > init/Makefile | 2 +- > kernel/Kconfig.preempt | 12 ++++++++---- > kernel/entry/common.c | 3 +-- > kernel/sched/core.c | 26 +++++++++++--------------- > kernel/sched/features.h | 6 ++++++ > 5 files changed, 27 insertions(+), 22 deletions(-) > > diff --git a/init/Makefile b/init/Makefile > index 385fd80fa2ef..99e480f24cf3 100644 > --- a/init/Makefile > +++ b/init/Makefile > @@ -24,7 +24,7 @@ mounts-$(CONFIG_BLK_DEV_INITRD) += do_mounts_initrd.o > # > > smp-flag-$(CONFIG_SMP) := SMP > -preempt-flag-$(CONFIG_PREEMPT) := PREEMPT > +preempt-flag-$(CONFIG_PREEMPTION) := PREEMPT_DYNAMIC > preempt-flag-$(CONFIG_PREEMPT_RT) := PREEMPT_RT > > build-version = $(or $(KBUILD_BUILD_VERSION), $(build-version-auto)) > diff --git a/kernel/Kconfig.preempt b/kernel/Kconfig.preempt > index aa87b5cd3ecc..074fe5e253b5 100644 > --- a/kernel/Kconfig.preempt > +++ b/kernel/Kconfig.preempt > @@ -6,20 +6,23 @@ choice > > config PREEMPT_NONE > bool "No Forced Preemption (Server)" > + select PREEMPTION > help > This is the traditional Linux preemption model, geared towards > throughput. It will still provide good latencies most of the > - time, but there are no guarantees and occasional longer delays > - are possible. > + time, but occasional delays are possible. > > Select this option if you are building a kernel for a server or > scientific/computation system, or if you want to maximize the > raw processing power of the kernel, irrespective of scheduling > - latencies. > + latencies. Unless your architecture actively disables preemption, > + you can always switch to one of the other preemption models > + at runtime. > diff --git a/kernel/entry/common.c b/kernel/entry/common.c > index 6433e6c77185..f7f2efabb5b5 100644 > --- a/kernel/entry/common.c > +++ b/kernel/entry/common.c > @@ -422,8 +422,7 @@ noinstr void irqentry_exit(struct pt_regs *regs, irqentry_state_t state) > } > > instrumentation_begin(); > - if (IS_ENABLED(CONFIG_PREEMPTION)) > - irqentry_exit_cond_resched(); > + irqentry_exit_cond_resched(); > /* Covers both tracing and lockdep */ > trace_hardirqs_on(); > instrumentation_end(); I'm totally confused by the PREEMPT_NONE changes here. How does that make sense?