Re: Selecting the scheduler from boot menu
Milan Obuch <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.hackers |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 1 Feb 2026 14:11:17 +0000 Shawn Webb <[email protected]> wrote: > On Sun, Feb 01, 2026 at 10:56:45AM +0100, Olivier Certner wrote: > > Hi Steve, > > > > > Yes, it is a convenience to have menu item. Dropping to the > > > loader prompt is possible. Taking it to a logical extreme, > > > let's retire the menu because everything can be set at the > > > loader prompt > > > > Space in the menu is limited, so I don't think we should > > necessarily add every possible tweak there, especially if it's not > > to be used a lot. > > > Well, if developers would like to see testing under > > > different loading situations, then make it easier to > > > switch from one scheduler to the other. > > > > Developers certainly don't need that, it's easy enough to type 'set > > kern.sched.name=4BSD' at the loader's prompt. > > > > And if you want to use 4BSD by default, it's also easy enough to > > put the relevant line in 'loader.conf'. > > I wonder if there are other approaches to take. For example, perhaps > an "Advanced" submenu could be created. The new scheduler picker could > go there. > > I'm not saying to do that, just plopping an idea out there. > 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. Regards, Milan
menu.lua.patch
(text/x-patch, 708 B)
--- /boot/lua/menu.lua.orig 2025-11-28 04:42:57.000000000 +0100
+++ /boot/lua/menu.lua 2026-02-18 11:21:08.570387000 +0100
@@ -258,6 +258,7 @@
name = "Kernel:",
},
menu_entries.kernel_options,
+ menu_entries.scheduler_choice,
{
entry_type = core.MENU_SEPARATOR,
},
@@ -432,6 +433,17 @@
entry_type = core.MENU_ENTRY,
visible = function()
return false
+ end
+ },
+ scheduler_choice = {
+ entry_type = core.MENU_CAROUSEL_ENTRY,
+ carousel_id = "scheduler",
+ items = {"ULE", "4BSD"},
+ name = function(_, choice, _)
+ return "scheduler " .. choice
+ end,
+ func = function(_, choice, _)
+ loader.setenv("kern.sched.name",choice)
end
},
},