From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B2BDA3264FB for ; Fri, 17 Jul 2026 11:36:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784288163; cv=none; b=jHygxCce/Wz7QEwOhd/SONgYkVnNf8O4Yhb8M6avlaM4P/J0pBmsDhHsyQB+EAqFOQ519sRFa8qgu7mHEZeDxY6hjJeFDOYkELpIsKP6I2ZUnI60OD04Nszg2BjcCTCozynf4HwV8SucPVqk7zoDtQIdsimXmDZsZxwZBzXjWHc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784288163; c=relaxed/simple; bh=XKfhE6ELTcnzLscZkcrNnDH48L4oep/T4jr+iWhGedc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=EJoJqk+dyZtNSLzHBTOPQCAJOyqUubJlB38AQaYgSoCrqlZSfh8TEQRrWb9G0fRaNRV3OZ6gvdXbeLzpQdlTklKP0DKj7bsqmwa1vMSKYDNhs0xgUHHhQhbq/6a49WHKQCxcgIxIzVvXxnI27yxnczYQ4UP2jOwgnMztSm8KJDo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=BejSYoqW; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="BejSYoqW" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A4A321476; Fri, 17 Jul 2026 04:35:55 -0700 (PDT) Received: from J2N7QTR9R3 (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4D9233F7B4; Fri, 17 Jul 2026 04:35:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1784288159; bh=XKfhE6ELTcnzLscZkcrNnDH48L4oep/T4jr+iWhGedc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=BejSYoqWU+35aVi81G1p7OZbgpvFOcGyrhHAJmrxDf1K0VOTXjF9kcBKPWyX9kUkZ M4pzKOARJw80Cbb2mF6pvS3V9mTYcw+/ljVnuFr9rRSoW8Yil7I7s6AfAA8IOkrtt/ gjcKWn89UjKDOn6Wd+iDXZZtfp3TKdNXzrKlDoUg= Date: Fri, 17 Jul 2026 12:35:55 +0100 From: Mark Rutland To: Shrikanth Hegde Cc: linux-kernel@vger.kernel.org, frederic@kernel.org, jstultz@google.com, juri.lelli@redhat.com, mingo@redhat.com, peterz@infradead.org, tglx@linutronix.de, vincent.guittot@linaro.org, vschneid@redhat.com Subject: Re: [PATCH 0/5] sched: dynamic: Simplify PREEMPT_DYNAMIC Message-ID: References: <20260703133358.698078-1-mark.rutland@arm.com> <54d24191-efd1-418d-92df-20ca6d385675@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <54d24191-efd1-418d-92df-20ca6d385675@linux.ibm.com> On Mon, Jul 06, 2026 at 10:00:47AM +0530, Shrikanth Hegde wrote: > Hi Mark, > > On 7/3/26 7:03 PM, Mark Rutland wrote: > > All architectures which currently suppoort PREEMPT_DYNAMIC select > > ARCH_HAS_PREEMPT_LAZY. On architectures which select > > ARCH_HAS_PREEMPT_LAZY, it has not been possible to select the NONE and > > VOLUNTARY preemption models since v7.0 due to commit: > > > > 7dadeaa6e851 ("sched: Further restrict the preemption modes") > > > > Hence in practice PREEMPT_DYNAMIC no longer supports the NONE or > > VOLUNTARY preemption models. > > > > This series makes the de-facto situation official by making > > PREEMPT_DYNAMIC depend on ARCH_HAS_PREEMPT_LAZY, and removing all the > > redundant code. > > This cleanup looks good indeed. little bit more cleanup can be added, > details of it at the end. > > > > > For x86_64 v7.2-rc1 defconfig built with GCC 10.2.1, this makes the > > bzImage 28K smaller, mostly due to removing NOPs that will never be > > patched to {cond,might}_resched() at runtime: > > > > [mark@lakrids:~/src/linux]% ls -al vmlinux-* > > -rwxr-xr-x 1 mark mark 53844952 Jul 3 14:09 vmlinux-after > > -rwxr-xr-x 1 mark mark 53842856 Jul 3 14:09 vmlinux-before > > Is this reversed? How come vmlinux is more whereas bzImage is less? Not reversed! The vmlinux after is bigger (but the bzImage is smaller). I'm not immediately sure why. I rebuilt afresh, and I see: [mark@lakrids:~/src/linux]% ls -l ../vmlinux-* -rwxr-xr-x 1 mark mark 53844952 Jul 6 15:42 ../vmlinux-after -rwxr-xr-x 1 mark mark 53842856 Jul 6 15:45 ../vmlinux-before [mark@lakrids:~/src/linux]% size ../vmlinux-* text data bss dec hex filename 31064917 8823782 1112412 41001111 271a097 ../vmlinux-after 31066343 8860886 1112548 41039777 27237a1 ../vmlinux-before [mark@lakrids:~/src/linux]% readelf -S ../vmlinux-* File: ../vmlinux-after There are 47 section headers, starting at offset 0x3359018: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .text PROGBITS ffffffff81000000 00200000 00000000012a5588 0000000000000000 AX 0 0 4096 [ 2] .rodata PROGBITS ffffffff82400000 01600000 0000000000757ae6 0000000000000000 WA 0 0 4096 [ 3] .pci_fixup PROGBITS ffffffff82b57af0 01d57af0 0000000000003c60 0000000000000000 A 0 0 16 [ 4] .tracedata PROGBITS ffffffff82b5b750 01d5b750 0000000000000078 0000000000000000 A 0 0 1 [ 5] __ksymtab PROGBITS ffffffff82b5b7c8 01d5b7c8 0000000000025fec 0000000000000000 A 0 0 4 [ 6] __kflagstab PROGBITS ffffffff82b817b4 01d817b4 00000000000032a9 0000000000000000 A 0 0 1 [ 7] __ksymtab_strings PROGBITS ffffffff82b84a5d 01d84a5d 00000000000412a9 0000000000000001 AMS 0 0 1 [ 8] __init_rodata PROGBITS ffffffff82bc5d20 01dc5d20 0000000000000030 0000000000000000 A 0 0 32 [ 9] __param PROGBITS ffffffff82bc5d50 01dc5d50 00000000000056e0 0000000000000000 A 0 0 8 [10] __modver PROGBITS ffffffff82bcb430 01dcb430 00000000000003f0 0000000000000000 A 0 0 8 [11] __ex_table PROGBITS ffffffff82bcb820 01dcb820 00000000000046b0 000000000000000c AM 0 0 4 [12] .notes NOTE ffffffff82bcfed0 01dcfed0 0000000000000054 0000000000000000 A 0 0 4 [13] .data PROGBITS ffffffff82c00000 01e00000 00000000002edf80 0000000000000000 WAX 0 0 8192 [14] __bug_table PROGBITS ffffffff82eedf80 020edf80 000000000002f4e0 0000000000000000 WA 0 0 1 [15] .orc_header PROGBITS ffffffff82f1d460 0211d460 0000000000000014 0000000000000000 A 0 0 4 [16] .orc_unwind_ip PROGBITS ffffffff82f1d474 0211d474 0000000000233238 0000000000000000 A 0 0 1 [17] .orc_unwind PROGBITS ffffffff831506ac 023506ac 000000000034cb54 0000000000000000 A 0 0 1 [18] .orc_lookup NOBITS ffffffff8349d200 0269d200 000000000004a95c 0000000000000000 WA 0 0 1 [19] .init.text PROGBITS ffffffff834e8000 026e8000 000000000008e59f 0000000000000000 AX 0 0 16 [20] .altinstr_aux PROGBITS ffffffff8357659f 0277659f 0000000000003a61 0000000000000000 AX 0 0 1 [21] .init.data PROGBITS ffffffff8357a000 0277a000 00000000000b75b0 0000000000000000 WA 0 0 8192 [22] .x86_cpu_dev.init PROGBITS ffffffff836315b0 028315b0 0000000000000028 0000000000000000 A 0 0 8 [23] .retpoline_sites PROGBITS ffffffff836315d8 028315d8 0000000000011084 0000000000000000 A 0 0 1 [24] .return_sites PROGBITS ffffffff83642660 02842660 0000000000048f60 0000000000000000 A 0 0 1 [25] .call_sites PROGBITS ffffffff8368b5c0 0288b5c0 00000000000fb5b4 0000000000000000 A 0 0 1 [26] .ibt_endbr_seal PROGBITS ffffffff83786b78 02986b78 000000000000f160 0000000000000000 A 0 0 1 [27] .altinstructions PROGBITS ffffffff83795cd8 02995cd8 0000000000009fe8 000000000000000e AM 0 0 1 [28] .altinstr_re[...] PROGBITS ffffffff8379fcc0 0299fcc0 0000000000002720 0000000000000000 AX 0 0 1 [29] .apicdrivers PROGBITS ffffffff837a23e0 029a23e0 0000000000000018 0000000000000000 WA 0 0 8 [30] .exit.text PROGBITS ffffffff837a2400 029a2400 0000000000003b8b 0000000000000000 AX 0 0 16 [31] .data..percpu PROGBITS ffffffff837a6000 029a6000 000000000002ae58 0000000000000000 WA 0 0 4096 [32] runtime_shif[...] PROGBITS ffffffff837d0e58 029d0e58 0000000000000014 0000000000000000 A 0 0 1 [33] runtime_ptr_[...] PROGBITS ffffffff837d0e70 029d0e70 0000000000000014 0000000000000000 A 0 0 1 [34] runtime_ptr_[...] PROGBITS ffffffff837d0e88 029d0e88 0000000000000014 0000000000000000 A 0 0 1 [35] runtime_ptr_[...] PROGBITS ffffffff837d0ea0 029d0ea0 0000000000000014 0000000000000000 A 0 0 1 [36] runtime_ptr_[...] PROGBITS ffffffff837d0eb8 029d0eb8 0000000000000010 0000000000000000 A 0 0 1 [37] runtime_ptr_[...] PROGBITS ffffffff837d0ec8 029d0ec8 000000000000000c 0000000000000000 A 0 0 1 [38] runtime_ptr_[...] PROGBITS ffffffff837d0ed8 029d0ed8 0000000000000274 0000000000000000 A 0 0 1 [39] .smp_locks PROGBITS ffffffff837d2000 029d2000 000000000000e000 0000000000000000 A 0 0 4 [40] .data_nosave PROGBITS ffffffff837e0000 029e0000 0000000000001000 0000000000000000 WA 0 0 4 [41] .bss NOBITS ffffffff837e1000 029e1000 0000000000095000 0000000000000000 WA 0 0 4096 [42] .brk NOBITS ffffffff83876000 029e1000 0000000000030000 0000000000000000 WA 0 0 1 [43] .comment PROGBITS 0000000000000000 029e1000 0000000000000027 0000000000000001 MS 0 0 1 [44] .symtab SYMTAB 0000000000000000 029e1028 0000000000550530 0000000000000018 45 157665 8 [45] .strtab STRTAB 0000000000000000 02f31558 000000000042784a 0000000000000000 0 0 1 [46] .shstrtab STRTAB 0000000000000000 03358da2 0000000000000273 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), l (large), p (processor specific) File: ../vmlinux-before There are 47 section headers, starting at offset 0x33587e8: Section Headers: [Nr] Name Type Address Offset Size EntSize Flags Link Info Align [ 0] NULL 0000000000000000 00000000 0000000000000000 0000000000000000 0 0 0 [ 1] .text PROGBITS ffffffff81000000 00200000 00000000012a7770 0000000000000000 AX 0 0 4096 [ 2] .rodata PROGBITS ffffffff82400000 01600000 0000000000760c46 0000000000000000 WA 0 0 4096 [ 3] .pci_fixup PROGBITS ffffffff82b60c50 01d60c50 0000000000003c60 0000000000000000 A 0 0 16 [ 4] .tracedata PROGBITS ffffffff82b648b0 01d648b0 0000000000000078 0000000000000000 A 0 0 1 [ 5] __ksymtab PROGBITS ffffffff82b64928 01d64928 0000000000026028 0000000000000000 A 0 0 4 [ 6] __kflagstab PROGBITS ffffffff82b8a950 01d8a950 00000000000032ae 0000000000000000 A 0 0 1 [ 7] __ksymtab_strings PROGBITS ffffffff82b8dbfe 01d8dbfe 00000000000412e0 0000000000000001 AMS 0 0 1 [ 8] __init_rodata PROGBITS ffffffff82bceee0 01dceee0 0000000000000030 0000000000000000 A 0 0 32 [ 9] __param PROGBITS ffffffff82bcef10 01dcef10 00000000000056e0 0000000000000000 A 0 0 8 [10] __modver PROGBITS ffffffff82bd45f0 01dd45f0 00000000000003f0 0000000000000000 A 0 0 8 [11] __ex_table PROGBITS ffffffff82bd49e0 01dd49e0 00000000000046b0 000000000000000c AM 0 0 4 [12] .notes NOTE ffffffff82bd9090 01dd9090 0000000000000054 0000000000000000 A 0 0 4 [13] .data PROGBITS ffffffff82c00000 01e00000 00000000002edf80 0000000000000000 WAX 0 0 8192 [14] __bug_table PROGBITS ffffffff82eedf80 020edf80 000000000002f470 0000000000000000 WA 0 0 1 [15] .orc_header PROGBITS ffffffff82f1d3f0 0211d3f0 0000000000000014 0000000000000000 A 0 0 4 [16] .orc_unwind_ip PROGBITS ffffffff82f1d404 0211d404 00000000002339d4 0000000000000000 A 0 0 1 [17] .orc_unwind PROGBITS ffffffff83150dd8 02350dd8 000000000034d6be 0000000000000000 A 0 0 1 [18] .orc_lookup NOBITS ffffffff8349e498 0269e496 000000000004a9e4 0000000000000000 WA 0 0 1 [19] .init.text PROGBITS ffffffff834e9000 026e9000 000000000008e53f 0000000000000000 AX 0 0 16 [20] .altinstr_aux PROGBITS ffffffff8357753f 0277753f 0000000000003ac1 0000000000000000 AX 0 0 1 [21] .init.data PROGBITS ffffffff8357c000 0277c000 00000000000b75b0 0000000000000000 WA 0 0 8192 [22] .x86_cpu_dev.init PROGBITS ffffffff836335b0 028335b0 0000000000000028 0000000000000000 A 0 0 8 [23] .retpoline_sites PROGBITS ffffffff836335d8 028335d8 0000000000011064 0000000000000000 A 0 0 1 [24] .return_sites PROGBITS ffffffff83644640 02844640 0000000000048f28 0000000000000000 A 0 0 1 [25] .call_sites PROGBITS ffffffff8368d568 0288d568 00000000000f863c 0000000000000000 A 0 0 1 [26] .ibt_endbr_seal PROGBITS ffffffff83785ba8 02985ba8 000000000000f15c 0000000000000000 A 0 0 1 [27] .altinstructions PROGBITS ffffffff83794d08 02994d08 0000000000009fe8 000000000000000e AM 0 0 1 [28] .altinstr_re[...] PROGBITS ffffffff8379ecf0 0299ecf0 0000000000002720 0000000000000000 AX 0 0 1 [29] .apicdrivers PROGBITS ffffffff837a1410 029a1410 0000000000000018 0000000000000000 WA 0 0 8 [30] .exit.text PROGBITS ffffffff837a1430 029a1430 0000000000003b8b 0000000000000000 AX 0 0 16 [31] .data..percpu PROGBITS ffffffff837a5000 029a5000 000000000002ae58 0000000000000000 WA 0 0 4096 [32] runtime_shif[...] PROGBITS ffffffff837cfe58 029cfe58 0000000000000014 0000000000000000 A 0 0 1 [33] runtime_ptr_[...] PROGBITS ffffffff837cfe70 029cfe70 0000000000000014 0000000000000000 A 0 0 1 [34] runtime_ptr_[...] PROGBITS ffffffff837cfe88 029cfe88 0000000000000014 0000000000000000 A 0 0 1 [35] runtime_ptr_[...] PROGBITS ffffffff837cfea0 029cfea0 0000000000000014 0000000000000000 A 0 0 1 [36] runtime_ptr_[...] PROGBITS ffffffff837cfeb8 029cfeb8 0000000000000010 0000000000000000 A 0 0 1 [37] runtime_ptr_[...] PROGBITS ffffffff837cfec8 029cfec8 000000000000000c 0000000000000000 A 0 0 1 [38] runtime_ptr_[...] PROGBITS ffffffff837cfed8 029cfed8 0000000000000274 0000000000000000 A 0 0 1 [39] .smp_locks PROGBITS ffffffff837d1000 029d1000 000000000000e000 0000000000000000 A 0 0 4 [40] .data_nosave PROGBITS ffffffff837df000 029df000 0000000000001000 0000000000000000 WA 0 0 4 [41] .bss NOBITS ffffffff837e0000 029e0000 0000000000095000 0000000000000000 WA 0 0 4096 [42] .brk NOBITS ffffffff83875000 029e0000 0000000000030000 0000000000000000 WA 0 0 1 [43] .comment PROGBITS 0000000000000000 029e0000 0000000000000027 0000000000000001 MS 0 0 1 [44] .symtab SYMTAB 0000000000000000 029e0028 0000000000550830 0000000000000018 45 157685 8 [45] .strtab STRTAB 0000000000000000 02f30858 0000000000427d16 0000000000000000 0 0 1 [46] .shstrtab STRTAB 0000000000000000 0335856e 0000000000000273 0000000000000000 0 0 1 Key to Flags: W (write), A (alloc), X (execute), M (merge), S (strings), I (info), L (link order), O (extra OS processing required), G (group), T (TLS), C (compressed), x (unknown), o (OS specific), E (exclude), l (large), p (processor specific) > Btw, I ran it on powerpc, builds and boots. Thanks for testing! > Bloat-o-meter says, > Total: Before=32286154, After=32267870, chg -0.06% Yep, similar on x86_64, v7.21-r1, defconfig: Total: Before=24064357, After=24052508, chg -0.05% Similar on arm64 too, but I don't have the numbers to hand. [...] > In addition, > I think you can also remove accessor methods of none, voluntary. > I see preempt_model_none is used. (Though one may question its usage there). > That wrapper can be outside of #ifdef as preempt dynamic can't choose > none/voluntary. Sure. For consistency, I think it makes sense to keep implementations of preempt_model_none() and preempt_model_voluntary() that just check CONFIG_PREEMPT_{NONE,VOLUNTARY}, as in your diff below, even if we only use preempt_model_none() in one place today. I'll add a patch to the end of the series. Thanks! Mark. > > --- > > diff --git a/include/linux/preempt.h b/include/linux/preempt.h > index d964f965c8ff..b4dd4fc13cf8 100644 > --- a/include/linux/preempt.h > +++ b/include/linux/preempt.h > @@ -469,22 +469,9 @@ DEFINE_LOCK_GUARD_0(preempt, preempt_disable(), preempt_enable()) > DEFINE_LOCK_GUARD_0(preempt_notrace, preempt_disable_notrace(), preempt_enable_notrace()) > #ifdef CONFIG_PREEMPT_DYNAMIC > - > -extern bool preempt_model_none(void); > -extern bool preempt_model_voluntary(void); > extern bool preempt_model_full(void); > extern bool preempt_model_lazy(void); > - > #else > - > -static inline bool preempt_model_none(void) > -{ > - return IS_ENABLED(CONFIG_PREEMPT_NONE); > -} > -static inline bool preempt_model_voluntary(void) > -{ > - return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY); > -} > static inline bool preempt_model_full(void) > { > return IS_ENABLED(CONFIG_PREEMPT); > @@ -494,9 +481,16 @@ static inline bool preempt_model_lazy(void) > { > return IS_ENABLED(CONFIG_PREEMPT_LAZY); > } > - > #endif > +static inline bool preempt_model_none(void) > +{ > + return IS_ENABLED(CONFIG_PREEMPT_NONE); > +} > +static inline bool preempt_model_voluntary(void) > +{ > + return IS_ENABLED(CONFIG_PREEMPT_VOLUNTARY); > +} > static inline bool preempt_model_rt(void) > { > return IS_ENABLED(CONFIG_PREEMPT_RT); > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 9eb279eade26..59a8c8e63ca1 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -7815,8 +7815,6 @@ EXPORT_SYMBOL(__cond_resched_rwlock_write); > enum { > preempt_dynamic_undefined = -1, > - preempt_dynamic_none, > - preempt_dynamic_voluntary, > preempt_dynamic_full, > preempt_dynamic_lazy, > }; > @@ -7901,8 +7899,6 @@ static void __init preempt_dynamic_init(void) > } \ > EXPORT_SYMBOL_GPL(preempt_model_##mode) > -PREEMPT_MODEL_ACCESSOR(none); > -PREEMPT_MODEL_ACCESSOR(voluntary); > PREEMPT_MODEL_ACCESSOR(full); > PREEMPT_MODEL_ACCESSOR(lazy); >