tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Linker error (multiple definition) during LD_STAGE 2 with custom scheduler



On Fri, Jun 19, 2026 at 22:42:19 +0300, sewas1399%gmail.com@localhost wrote:

> Could someone please explain how the NetBSD build system and linker
> handle symbol overriding for alternative schedulers? How does
> sched_m2.c avoid multiple definition conflicts with kern_runq.c, and
> what is the proper way to hook a custom scheduler into the kernel to
> avoid this collision?

Read up on config(5).  Schedulers are not dynamically pluggable, so
you need to select which one you are compiling in.  If you look at the
history of sys/conf/files you can see:

  revision 1.868
  date: 2007-10-09 23:00:13 +0400;  author: rmind;  state: Exp;  lines: +3 -1;
  Import of SCHED_M2 - the implementation of new scheduler, which is based
  on the original approach of SVR4 with some inspirations about balancing
  and migration from Solaris.  It implements per-CPU runqueues, provides a
  real-time (RT) and time-sharing (TS) queues, ready to support a POSIX
  real-time extensions, and also prepared for the support of CPU affinity.

  The following lines in the kernel config enables the SCHED_M2:

  no options SCHED_4BSD
  options SCHED_M2

  The scheduler seems to be stable.  Further work will come soon.

You need to do similar song and dance to get your scheduler compiled
into the kernel instead of the default 4BSD or M2.

-uwe


Home | Main Index | Thread Index | Old Index