https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=246940
Bug ID: 246940 Summary: [wishlist/enhancement, patch incl.]: idle user tasks should be charged as "nice" or "user" CPU time Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Many People Priority: --- Component: kern Assignee: b...@freebsd.org Reporter: torsten.eichsta...@web.de Created attachment 215172 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=215172&action=edit Patch for FreeBSD-12: sys.kern.kern_clock.c.diff Currently idle user tasks are charged as "user" CPU time. 1. This is counter-intuitive. Instead, one would expect the requested behaviour. 2. The chargement of user tasks affects the decisions taken by a CPU freq manager (i.e. powerd(8), sysutils/powerdxx(8) and the according kernel modules) and thus can result in great power savings for mobile users, and/or a less noisier system for desktop users, provided the user does not care about the runtime of background tasks, since power managers do not increase CPU freq on behalve of idle user tasks. 3. The patch might affect the CPU scheduler, please check. I have no clue about this. 4. The patch introduces a new global integer sysctl "kern.cp_time_mode": [value: behaviour; use-case] 1: charge idle threads as "nice" CPU time; suggested as server mode 2: " "idle" CPU time; suggested as mobile/desktop mode 0/any other: " "user" CPU time; (default); current behaviour I would be interested in how such "static" sysctl's are handled on a SMP system. If "OID_AUTO" results in a per-CPU var, a system could be partitioned to have "interesting" behaviour :) Onother question I have is if kernel tasks (other than the idle task itself) could ever be in the idle class. I ran this trivial patch on two laptops for several years w/o problems. There might be implicit assumptions on the CPU scheduling class beeing "user" or "nice" in some base system tasks or scripts, though. Suggested application is to switch between "server" and "mobile" mode from /etc/power_profile (I'm willing to patch that, it's trivial) and to allow security.bsd.unprivileged_idprio=1. Then a desktop/mobile user can choose to run cron(8), sysutils/anacron(8) and his own user background tasks as "idle", and enjoy increased battery runtime and a quiter system. How can I add more than one attachment? The patch for FreeBSD 10/11 is slightly different, statclock() was named statclock_cnt() and did not have a comment. With kind regards, Torsten -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"