avg 96691e46d1 fix a thread preemption regression in schedulers introduced in r270423
Commit r270423 fixed a regression in sched_yield() that was introduced
in earlier changes.  Unfortunately, at the same time it introduced an
new regression.  The problem is that SWT_RELINQUISH (6), like all other
SWT_* constants and unlike SW_* flags, is not a bit flag.  So, (flags &
SWT_RELINQUISH) is true in cases where that was not really indended,
for example, with SWT_OWEPREEMPT (2) and SWT_REMOTEPREEMPT (11).

A straight forward fix would be to use (flags & SW_TYPE_MASK) ==
SWT_RELINQUISH, but my impression is that the switch types are designed
mostly for gathering statistics, not for influencing scheduling
decisions.

So, I decided that it would be better to check for SW_PREEMPT flag
instead.  That's also the same flag that was checked before r239157.
I double-checked how that flag is used and I am confident that the flag
is set only in the places where we really have the preemption:
- critical_exit + td_owepreempt
- sched_preempt in the ULE scheduler
- sched_preempt in the 4BSD scheduler

Reviewed by:	kib, mav
MFC after:	4 days
Sponsored by:	Panzura
Differential Revision: https://reviews.freebsd.org/D9230
2017-01-19 18:46:41 +00:00
..
2016-10-04 15:23:03 +00:00
2016-10-04 17:57:30 +00:00
2016-11-08 23:59:41 +00:00
2016-12-27 20:22:17 +00:00
2016-11-08 23:59:41 +00:00
2016-09-18 07:37:00 +00:00
2016-07-27 11:40:06 +00:00
2016-11-08 23:59:41 +00:00
2016-10-11 17:00:29 +00:00
2016-10-24 16:40:27 +00:00
2017-01-14 04:16:13 +00:00
2016-12-27 20:22:17 +00:00
2016-12-27 20:22:17 +00:00
2016-07-26 17:23:49 +00:00
2016-04-14 17:07:26 +00:00
2016-10-21 18:27:30 +00:00
2016-08-17 10:14:22 +00:00
2016-12-29 16:35:49 +00:00