Re: Selecting the scheduler from boot menu

Milan Obuch <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
On Wed, 18 Feb 2026 12:05:05 +0100
Milan Obuch <[email protected]> wrote:

[ snip ]

> I had today an opportunity to do some boot menu hacking as I could do
> some reboots for tests, and I found it is quite easy to add a menu
> item into loader menu. See attached patch for result.
> 
> First chunk in this patch just places new entry after kernel select
> item, the second one actually defines new item's look and function.
> 
> It works - partially. When 4BSD is selected, kernel environment is
> changed:
> 
> # kenv | grep kern.sched
> kern.sched.name="4BSD"
> 
> (new variable is created), when this options is not touched, this
> variable does not exist. It is created, however, if I change scheduler
> option to 4BSD and then back to ULE:
> 
> # kenv | grep kern.sched
> kern.sched.name="ULE"
> 
> In all cases, however, actual change is not made, sysctl is not
> changed, every time I get
> 
> # sysctl kern.sched.name
> kern.sched.name: ULE
> 
> So we have simple method to do the loader menu stuff, next step is to
> find where actual change could be done (and how). Also, I did my tests
> on 15.0-STABLE built from sources from February 1st. It did not work
> for me even when entering
> 
> set kern.sched.name="4BSD"
> 
> from loader prompt and then booting my system.
> 
> Maybe test with 16-CURRENT is necessary for this to work... I have no
> box for this test right now.

I did a small test with 16-CURRENT installer image - I wrote an image
to USB flash disk, applied my patch to /boot/lua/menu.lua file and
verify it works as expected, namely when 4BSD scheduler is selected, I
see

# sysctl kern.sched.name
kern.sched.name: 4BSD

and that's it. This setting is temporary, if desired to change
scheduler to 4BSD, you still need to write it into /boot/loader.conf
file, as before:

kern.sched.name="4BSD"

Caveat: with this setting, boot menu still displays ULE as scheduler to
be used. If you really would like to select ULE with this setting
active in /boot/loader.conf file, you need to press 7 *twice*.

I am going to try to find a fix for this annoyance, some more testing
is necessary. But I think it is already usefull for someone even with
this flaw, I hope :)

Regards,
Milan
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.