On 2026-09-18 10:15, Minsoo Choo wrote:
The branch main has been updated by mchoo:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=962125aef24b55b4bb8808dcab335abc4b3f0d4e

commit 962125aef24b55b4bb8808dcab335abc4b3f0d4e
Author:     Minsoo Choo <[email protected]>
AuthorDate: 2026-09-05 01:02:07 +0000
Commit:     Minsoo Choo <[email protected]>
CommitDate: 2026-09-18 14:14:15 +0000

     sched: rename sched_schedcpu() to sched_sysinit()

     sched_schedcpu() is called only during SYSINIT to start kthread that
     calls schedcpu() every second in 4BSD, but its name implies it's doing
     what 4BSD's schedcpu() does. Rename this function to sched_sysinit() to
     mark that schedulers can use it for its own SYSINIT routine. Note that
     their SYSINIT routine does not necessarily need to be similar to 4BSD's
     decay in schedcpu().

     The scheduler.9 man page is planned to be rewritten from scratch, so no
     change to it for now.

     Reviewed by:    olce
     Approved by:    olce (mentor)
     MFC after:      2 weeks
     Sponsored by:   FreeBSD Foundation
     Differential Revision:  https://reviews.freebsd.org/D59437
---
  sys/kern/sched_4bsd.c | 4 ++--
  sys/kern/sched_shim.c | 6 +++---
  sys/kern/sched_ule.c  | 4 ++--
  sys/sys/sched.h       | 3 ++-
  4 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/sys/kern/sched_4bsd.c b/sys/kern/sched_4bsd.c
index 61b8c0e68691..5f0246323dea 100644
--- a/sys/kern/sched_4bsd.c
+++ b/sys/kern/sched_4bsd.c
@@ -161,7 +161,7 @@ static struct kproc_desc sched_kp = {
  };

  static void
-sched_4bsd_schedcpu(void)
+sched_4bsd_sysinit(void)
  {
        kproc_start(&sched_kp);
  }
@@ -1889,7 +1889,7 @@ struct sched_instance sched_4bsd_instance = {
        SLOT(init_ap),
        SLOT(setup),
        SLOT(initticks),
-       SLOT(schedcpu),
+       SLOT(sysinit),
  #undef SLOT
  };
  DECLARE_SCHEDULER(fourbsd_sched_selector, "4BSD", &sched_4bsd_instance);
diff --git a/sys/kern/sched_shim.c b/sys/kern/sched_shim.c
index 2ff97a5774e1..9935c4e40aa8 100644
--- a/sys/kern/sched_shim.c
+++ b/sys/kern/sched_shim.c
@@ -181,11 +181,11 @@ SYSINIT(sched_initticks, SI_SUB_CLOCKS, SI_ORDER_THIRD, 
sched_initticks,
      NULL);

  static void
-sched_schedcpu(void)
+sched_sysinit(void)
  {
-       active_sched->schedcpu();
+       active_sched->sysinit();
  }
-SYSINIT(schedcpu, SI_SUB_LAST, SI_ORDER_FIRST, sched_schedcpu, NULL);
+SYSINIT(sched_sysinit, SI_SUB_LAST, SI_ORDER_FIRST, sched_sysinit, NULL);

  SYSCTL_NODE(_kern, OID_AUTO, sched, CTLFLAG_RD | CTLFLAG_MPSAFE, 0,
      "Scheduler");
diff --git a/sys/kern/sched_ule.c b/sys/kern/sched_ule.c
index ca55e5c1da7b..ea5f63311387 100644
--- a/sys/kern/sched_ule.c
+++ b/sys/kern/sched_ule.c
@@ -3347,7 +3347,7 @@ sched_ule_clear_tdname(struct thread *td)
  }

  static void
-sched_ule_schedcpu(void)
+sched_ule_sysinit(void)
  {
  }

@@ -3465,7 +3465,7 @@ struct sched_instance sched_ule_instance = {
        SLOT(init_ap),
        SLOT(setup),
        SLOT(initticks),
-       SLOT(schedcpu),
+       SLOT(sysinit),
  #undef SLOT
  };
  DECLARE_SCHEDULER(ule_sched_selector, "ULE", &sched_ule_instance);
diff --git a/sys/sys/sched.h b/sys/sys/sched.h
index 9d8268d43d63..e4cf848cf641 100644
--- a/sys/sys/sched.h
+++ b/sys/sys/sched.h
@@ -323,7 +323,8 @@ struct sched_instance {
        void    (*init_ap)(void);
        void    (*setup)(void);
        void    (*initticks)(void);
-       void    (*schedcpu)(void);
+       /* Scheduler init, to be called only from 'sched_shim.c'. */
+       void    (*sysinit)(void);
  };

  extern const struct sched_instance *active_sched;

The MFC only applies to the stable/15 branch. I forgot to add

MFC to: stable/15

in the commit message.

--

Minsoo Choo


Reply via email to