Skip to content

Strip residual sched/time surface after fair-tiny#14

Merged
jserv merged 1 commit intomainfrom
sched-next
May 1, 2026
Merged

Strip residual sched/time surface after fair-tiny#14
jserv merged 1 commit intomainfrom
sched-next

Conversation

@jserv
Copy link
Copy Markdown
Owner

@jserv jserv commented May 1, 2026

6 out-of-tree patches stack on top of 0014 to land another 16,416 bytes of linux.axf (-14,528 of resident .text):

0015 SCHED_TOPOLOGY_MINIMAL (default n; set y)
Wraps kernel/sched/topology.c in #ifndef and substitutes a
minimal stub: def_root_domain + init_rootdomain +
init_defrootdomain + rq_attach_root + sched_get/put_rd +
sched_domains_mutex helpers + empty sched_init_domains and
partition_sched_domains. Drops sched_domain construction,
NUMA, perf-domain, asym-capacity, and topology debug.
topology.c 5,028 -> 70 B / 23 -> 6 syms.

0016 SCHED_NO_RICH_API (default n; set y)
Gates 11 SYSCALL_DEFINEs in kernel/sched/syscalls.c
(sched_set/getparam, set/getscheduler, set/getattr,
set/getaffinity, get_priority_{max,min}, rr_get_interval).
sys_ni.c gains COND_SYSCALL aliases so each slot returns
-ENOSYS. Internal helpers (sched_set_fifo*,
sched_setscheduler_nocheck, sched_setattr_nocheck,
sched_setaffinity, sched_getaffinity, __sched_setaffinity,
dl_task_check_affinity) stay live for RCU / kthread / compat
callers. sched_yield (158) and nice (34) unaffected.
syscalls.c 3,192 -> 2,068 B / 41 -> 21 syms.

0017 POSIX_CPU_TIMERS (default y; set n)
Wraps kernel/time/posix-cpu-timers.c in #ifdef and
substitutes k_clock dispatch tables for clock_process /
clock_thread / clock_posix_cpu that return -EINVAL via four
shared stub methods, plus no-op stubs for
posix_cputimers_group_init, run_posix_cpu_timers,
update_rlimit_cpu, thread_group_sample_cputime,
set_process_cpu_timer, posix_cpu_timers_exit{,_group}.
Effective syscall impact: clock_gettime / clock_getres /
clock_nanosleep on CLOCK_PROCESS_CPUTIME_ID and
CLOCK_THREAD_CPUTIME_ID return -EINVAL; setrlimit(RLIMIT_CPU)
and ITIMER_PROF / ITIMER_VIRTUAL become silent no-ops.
posix-cpu-timers.c 3,722 -> 66 B / 42 -> 11 syms.

0018 SCHED_PELT_RT_MINI (default n; set y)
Stubs CFS-side (__update_load_avg_blocked_se / _se / _cfs_rq)
and DL-side (update_dl_rq_load_avg) PELT entry points in
kernel/sched/pelt.c to return 0; update_other_load_avgs
collapses to a thin call into update_rt_rq_load_avg. Helpers
(decay_load, __accumulate_pelt_segments, accumulate_sum,
___update_load_sum, ___update_load_avg, runnable_avg_yN_inv)
stay live for rt.c. Combined with 0019, all of pelt.c
becomes LTO-strippable. pelt.c 1,758 -> 470 B / 8 -> 7 syms.

0019 SCHED_RT_TINY (default n; set y)
Wraps kernel/sched/rt.c in #ifndef and substitutes a fixed-
priority FIFO class reusing the existing rt_rq->active
priority-bitmap + per-priority list_head data structure.
Drops SCHED_RR slice rotation (RR collapses to FIFO), RT
bandwidth period/runtime timer, throttle, push/pull migration
(UP-only target makes the migration surface dead),
cpupri-driven find_lowest_rq, and sched_rt/rr_handler sysctl
writers. Cross-priority preemption stays via resched_curr;
RT > fair preemption stays via the class-chain walk.
get_rr_interval_rt returns 0 for SCHED_FIFO (mainline
contract). rt.c 3,400 -> 606 B / 34 -> 16 syms.

0020 TIME_NO_SET_WALLCLOCK (default n; set y)
Short-circuits do_settimeofday64, do_adjtimex, and
timekeeping_warp_clock in kernel/time/timekeeping.c.
Effective userspace impact: settimeofday(2),
clock_settime(2), adjtimex(2), and stime(2) all return
-EPERM; clock_gettime(2) read paths stay live. NTP
discipline / leap-second / TAI helpers lose all in-tree
callers and become candidates for LTO dead-stripping.

build.sh: extend the apply_patch_once loop, set the 6 new Kconfigs (five =y, POSIX_CPU_TIMERS =n), extend the post-olddefconfig verification list.

Cumulative on the production build: vmlinux .text 755,888 ->
746,484 (-9,404), resident .text (subsystem-rollup) 713,412 -> 698,884 (-14,528), linux.axf 1,188,352 -> 1,171,936 (-16,416 / 4 pages). Per-bucket: kernel/sched 30,980 -> 21,568 (-30.4%), kernel/time 39,442 -> 35,446 (-10.1%).

Each patch boot-tested independently in QEMU MPS2-AN386 (busybox sleep, date, ps; background CPU hog plus interactive shell coexistence verified for 0019).

6 out-of-tree patches stack on top of 0014 to land another 16,416 bytes
of linux.axf (-14,528 of resident .text):

  0015 SCHED_TOPOLOGY_MINIMAL (default n; set y)
       Wraps kernel/sched/topology.c in #ifndef and substitutes a
       minimal stub: def_root_domain + init_rootdomain +
       init_defrootdomain + rq_attach_root + sched_get/put_rd +
       sched_domains_mutex helpers + empty sched_init_domains and
       partition_sched_domains.  Drops sched_domain construction,
       NUMA, perf-domain, asym-capacity, and topology debug.
       topology.c 5,028 -> 70 B / 23 -> 6 syms.

  0016 SCHED_NO_RICH_API (default n; set y)
       Gates 11 SYSCALL_DEFINEs in kernel/sched/syscalls.c
       (sched_set/getparam, set/getscheduler, set/getattr,
       set/getaffinity, get_priority_{max,min}, rr_get_interval).
       sys_ni.c gains COND_SYSCALL aliases so each slot returns
       -ENOSYS.  Internal helpers (sched_set_fifo*,
       sched_setscheduler_nocheck, sched_setattr_nocheck,
       sched_setaffinity, sched_getaffinity, __sched_setaffinity,
       dl_task_check_affinity) stay live for RCU / kthread / compat
       callers.  sched_yield (158) and nice (34) unaffected.
       syscalls.c 3,192 -> 2,068 B / 41 -> 21 syms.

  0017 POSIX_CPU_TIMERS (default y; set n)
       Wraps kernel/time/posix-cpu-timers.c in #ifdef and
       substitutes k_clock dispatch tables for clock_process /
       clock_thread / clock_posix_cpu that return -EINVAL via four
       shared stub methods, plus no-op stubs for
       posix_cputimers_group_init, run_posix_cpu_timers,
       update_rlimit_cpu, thread_group_sample_cputime,
       set_process_cpu_timer, posix_cpu_timers_exit{,_group}.
       Effective syscall impact: clock_gettime / clock_getres /
       clock_nanosleep on CLOCK_PROCESS_CPUTIME_ID and
       CLOCK_THREAD_CPUTIME_ID return -EINVAL; setrlimit(RLIMIT_CPU)
       and ITIMER_PROF / ITIMER_VIRTUAL become silent no-ops.
       posix-cpu-timers.c 3,722 -> 66 B / 42 -> 11 syms.

  0018 SCHED_PELT_RT_MINI (default n; set y)
       Stubs CFS-side (__update_load_avg_blocked_se / _se / _cfs_rq)
       and DL-side (update_dl_rq_load_avg) PELT entry points in
       kernel/sched/pelt.c to return 0; update_other_load_avgs
       collapses to a thin call into update_rt_rq_load_avg.  Helpers
       (decay_load, __accumulate_pelt_segments, accumulate_sum,
       ___update_load_sum, ___update_load_avg, runnable_avg_yN_inv)
       stay live for rt.c.  Combined with 0019, all of pelt.c
       becomes LTO-strippable.  pelt.c 1,758 -> 470 B / 8 -> 7 syms.

  0019 SCHED_RT_TINY (default n; set y)
       Wraps kernel/sched/rt.c in #ifndef and substitutes a fixed-
       priority FIFO class reusing the existing rt_rq->active
       priority-bitmap + per-priority list_head data structure.
       Drops SCHED_RR slice rotation (RR collapses to FIFO), RT
       bandwidth period/runtime timer, throttle, push/pull migration
       (UP-only target makes the migration surface dead),
       cpupri-driven find_lowest_rq, and sched_rt/rr_handler sysctl
       writers.  Cross-priority preemption stays via resched_curr;
       RT > fair preemption stays via the class-chain walk.
       get_rr_interval_rt returns 0 for SCHED_FIFO (mainline
       contract).  rt.c 3,400 -> 606 B / 34 -> 16 syms.

  0020 TIME_NO_SET_WALLCLOCK (default n; set y)
       Short-circuits do_settimeofday64, do_adjtimex, and
       timekeeping_warp_clock in kernel/time/timekeeping.c.
       Effective userspace impact: settimeofday(2),
       clock_settime(2), adjtimex(2), and stime(2) all return
       -EPERM; clock_gettime(2) read paths stay live.  NTP
       discipline / leap-second / TAI helpers lose all in-tree
       callers and become candidates for LTO dead-stripping.

build.sh: extend the apply_patch_once loop, set the 6 new Kconfigs
(five =y, POSIX_CPU_TIMERS =n), extend the post-olddefconfig
verification list.

Cumulative on the production build: vmlinux .text 755,888 ->
746,484 (-9,404), resident .text (subsystem-rollup) 713,412 ->
698,884 (-14,528), linux.axf 1,188,352 -> 1,171,936 (-16,416 /
4 pages).  Per-bucket: kernel/sched 30,980 -> 21,568 (-30.4%),
kernel/time 39,442 -> 35,446 (-10.1%).

Each patch boot-tested independently in QEMU MPS2-AN386
(busybox sleep, date, ps; background CPU hog plus interactive
shell coexistence verified for 0019).
@jserv jserv merged commit 42c804d into main May 1, 2026
2 checks passed
@jserv jserv deleted the sched-next branch May 1, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant