PR: 270785
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Adjust for min timeout before aligning to the next tick, not after.
Add documentation.
sys/kern/kern_umtx.c | ||
---|---|---|
712 | I suppose this will work only at the beginning of each hardclock tick, but not later due to get*() returning stale values. And I would not like to have additional binuptime() call here. I think it would be cheaper but almost as good to pass non-zero precision to msleep_sbt(). |
I also wonder if we should make the same tunable to affect other forms of sleep, or not. Is this the most pathological in implementations? May be so. considering there were no complains about others.
sys/kern/kern_umtx.c | ||
---|---|---|
712 | The semantic of umtx_min_timeout is quite different from the precision lowering. It works around similar but different app issues. I agree with the note about binuptime vs. getbinuptime, but please note that the call is only added for non-default configuration. IMO if user is going to slower down his machine responsiveness in this way, one more RDTSCP instruction does not matter. |
sys/kern/kern_umtx.c | ||
---|---|---|
712 | Yes, the semantics is different, precision does not always increase the time, but if the CPU is otherwise idle -- it does. And it is free. But I understand that is would depend on current implementation details, so I won't press this more. I've grown in the age of slow timecounters, I am still trying to avoid those pains. ;) |
sys/kern/kern_umtx.c | ||
---|---|---|
712 | And BTW, there is sbinuptime() to slightly compact the code. |
The Linux approach of letting this be specified on a per-process basis is perhaps nicer. In the case of the PR, only one (or maybe several?) processes require this special treatment. OTOH, I think Linux applies this setting to all user-initiated sleeps, which isn't necessary here.
lib/libthr/libthr.3 | ||
---|---|---|
230 |
IMO proccontrol(2) knob there would be an overkill. Might be I would look some day to add some bits to umtx(2).
The implementation looks ok, but this looks like it should be done via procctl instead. If, someday, one wants a similar workaround for a different sleeping system call (e.g., kevent/EVFILT_TIMER), they cannot reasonably reuse UMTX_OP. procctl() would also allow the use of proccontrol to modify the setting, the extra flexibility could be useful.