opnsense-src/sys/kern
Andriy Gapon ad9dadc437 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
..
bus_if.m "Buses" is the preferred plural of "bus" 2017-01-15 17:54:01 +00:00
capabilities.conf
clock_if.m
cpufreq_if.m
device_if.m
genassym.sh
imgact_aout.c
imgact_binmisc.c
imgact_elf.c
imgact_elf32.c
imgact_elf64.c
imgact_gzip.c
imgact_shell.c
inflate.c
init_main.c Fix improper use of "its". 2016-11-08 23:59:41 +00:00
init_sysent.c Regen after r310638. 2016-12-27 20:22:17 +00:00
kern_acct.c Revert r312119 and reword the intent to fix -Wshadow issues 2017-01-15 09:25:33 +00:00
kern_alq.c
kern_clock.c Initialize 'ticks' earlier in boot after 'hz' is set. 2016-11-22 01:02:59 +00:00
kern_clocksource.c
kern_condvar.c
kern_conf.c Undo r309891. Konstantin is right in that this condition normally 2016-12-12 19:11:04 +00:00
kern_cons.c
kern_context.c
kern_cpu.c
kern_cpuset.c
kern_ctf.c Fix improper use of "its". 2016-11-08 23:59:41 +00:00
kern_descrip.c Remove deprecated fgetsock() and fputsock(). 2017-01-13 22:16:41 +00:00
kern_dtrace.c
kern_dump.c Add support for encrypted kernel crash dumps. 2016-12-10 16:20:39 +00:00
kern_environment.c
kern_et.c Add labels to sysctls related to clocks. 2016-12-14 12:56:58 +00:00
kern_event.c Add kevent EVFILT_EMPTY for notification when a client has received all data 2017-01-16 08:25:33 +00:00
kern_exec.c Explicitely add "opt_compat.h" to kern_exec.c: fix powerpc LINT builds. 2017-01-06 16:56:24 +00:00
kern_exit.c When a zombie gets reparented due to the parent exit, send SIGCHLD to 2016-12-12 11:11:50 +00:00
kern_fail.c
kern_ffclock.c
kern_fork.c vfs: add vrefact, to be used when the vnode has to be already active 2016-12-12 15:37:11 +00:00
kern_gzio.c
kern_hhook.c
kern_idle.c
kern_intr.c
kern_jail.c
kern_khelp.c
kern_kthread.c
kern_ktr.c
kern_ktrace.c
kern_linker.c
kern_lock.c
kern_lockf.c
kern_lockstat.c
kern_loginclass.c
kern_malloc.c
kern_mbuf.c
kern_mib.c
kern_module.c
kern_mtxpool.c
kern_mutex.c mtx: plug open-coded mtx_lock access missed in r311172 2017-01-04 02:25:31 +00:00
kern_ntptime.c
kern_numa.c
kern_osd.c
kern_physio.c
kern_pmc.c
kern_poll.c
kern_priv.c
kern_proc.c Export the whole thread name in kinfo_proc 2016-12-07 15:04:22 +00:00
kern_procctl.c reaper: Make REAPER_KILL_SUBTREE actually work. 2016-12-14 22:49:20 +00:00
kern_prot.c
kern_racct.c
kern_rangelock.c
kern_rctl.c
kern_resource.c
kern_rmlock.c
kern_rwlock.c rwlock: reduce lock accesses similarly to r311172 2017-01-18 17:53:57 +00:00
kern_sdt.c
kern_sema.c
kern_sendfile.c Move bogus_page declaration to vm_page.h and initialization to vm_page.c. 2017-01-04 22:27:19 +00:00
kern_sharedpage.c
kern_shutdown.c Stop the scheduler upon panic even in non-SMP kernels. 2017-01-14 22:16:03 +00:00
kern_sig.c
kern_switch.c
kern_sx.c sx: reduce lock accesses similarly to r311172 2017-01-18 17:55:08 +00:00
kern_synch.c disambiguate msleep KASSERT diagnostics 2017-01-16 20:34:42 +00:00
kern_syscalls.c
kern_sysctl.c Document the existence of the {0, 6, ...} sysctl. 2016-12-15 15:45:11 +00:00
kern_tc.c Add labels to sysctls related to clocks. 2016-12-14 12:56:58 +00:00
kern_thr.c thr_set_name(): silently truncate the given name as needed 2016-12-03 01:14:21 +00:00
kern_thread.c
kern_time.c
kern_timeout.c Permit timed sleeps for threads other than thread0 before timers are working. 2016-11-25 18:02:43 +00:00
kern_umtx.c [mips] make UMTX_CHAINS configurable at compile time. 2016-11-15 01:34:38 +00:00
kern_uuid.c
kern_xxx.c
ksched.c
link_elf.c
link_elf_obj.c
linker_if.m
Make.tags.inc
Makefile
makesyscalls.sh
md4c.c
md5c.c
msi_if.m
p1003_1b.c
pic_if.m
posix4_mib.c
sched_4bsd.c fix a thread preemption regression in schedulers introduced in r270423 2017-01-19 18:46:41 +00:00
sched_ule.c fix a thread preemption regression in schedulers introduced in r270423 2017-01-19 18:46:41 +00:00
serdev_if.m
stack_protector.c
subr_acl_nfs4.c
subr_acl_posix1e.c
subr_autoconf.c
subr_blist.c
subr_bufring.c
subr_bus.c "Buses" is the preferred plural of "bus" 2017-01-15 17:54:01 +00:00
subr_bus_dma.c
subr_busdma_bufalloc.c
subr_capability.c
subr_clock.c
subr_counter.c Zero return value when counter_rate() switches over to next second and 2016-12-13 20:11:45 +00:00
subr_devmap.c
subr_devstat.c
subr_disk.c
subr_dummy_vdso_tc.c
subr_eventhandler.c
subr_fattime.c
subr_firmware.c Fix improper use of "its". 2016-11-08 23:59:41 +00:00
subr_gtaskqueue.c Remove Assert that seems to be hit in various configurations during 2017-01-16 19:01:41 +00:00
subr_hash.c
subr_hints.c
subr_intr.c
subr_kdb.c
subr_kobj.c
subr_lock.c
subr_log.c
subr_mbpool.c
subr_mchain.c
subr_module.c
subr_msgbuf.c
subr_param.c Initialize 'ticks' earlier in boot after 'hz' is set. 2016-11-22 01:02:59 +00:00
subr_pcpu.c
subr_pctrie.c
subr_power.c
subr_prf.c
subr_prof.c
subr_rman.c
subr_rtc.c
subr_sbuf.c
subr_scanf.c
subr_sfbuf.c
subr_sglist.c
subr_sleepqueue.c Add a comment explaining the race fixed by r310423. 2016-12-23 05:02:17 +00:00
subr_smp.c
subr_stack.c
subr_syscall.c
subr_taskqueue.c
subr_terminal.c
subr_trap.c
subr_turnstile.c
subr_uio.c
subr_unit.c Clean up trailing whitespace 2017-01-14 04:16:13 +00:00
subr_vmem.c
subr_witness.c
sys_capability.c
sys_generic.c
sys_pipe.c
sys_procdesc.c
sys_process.c
sys_socket.c Set MORETOCOME for AIO write requests on a socket. 2017-01-06 23:41:45 +00:00
syscalls.c Regen after r310638. 2016-12-27 20:22:17 +00:00
syscalls.master Rename the 'flags' argument to getfsstat() to 'mode' and validate it. 2016-12-27 20:21:11 +00:00
systrace_args.c Regen after r310638. 2016-12-27 20:22:17 +00:00
sysv_ipc.c
sysv_msg.c
sysv_sem.c
sysv_shm.c
tty.c Correct the comments about how much buffer is allocated. 2017-01-13 17:03:23 +00:00
tty_compat.c
tty_info.c
tty_inq.c Check tty_gone() after allocating IO buffers. The tty lock has to be 2017-01-13 16:37:38 +00:00
tty_outq.c Check tty_gone() after allocating IO buffers. The tty lock has to be 2017-01-13 16:37:38 +00:00
tty_pts.c
tty_tty.c
tty_ttydisc.c
uipc_accf.c
uipc_debug.c
uipc_domain.c
uipc_mbuf.c Suppress a warning about m_assertbuf being unused. 2017-01-15 03:53:20 +00:00
uipc_mbuf2.c Remove writability requirement for single-mbuf, contiguous-range 2017-01-12 06:38:03 +00:00
uipc_mbufhash.c
uipc_mqueue.c Initialize reserved bytes in struct mq_attr and its 32compat 2016-11-14 13:20:10 +00:00
uipc_sem.c
uipc_shm.c When tmpfs and POSIX shm pagein a page for the sole purpose of performing 2016-12-11 19:24:41 +00:00
uipc_sockbuf.c
uipc_socket.c Implement kernel support for hardware rate limited sockets. 2017-01-18 13:31:17 +00:00
uipc_syscalls.c
uipc_usrreq.c Add a new socket option SO_TS_CLOCK to pick from several different clock 2017-01-16 17:46:38 +00:00
vfs_acl.c
vfs_aio.c
vfs_bio.c Do not set BIO_DONE if the BIO specifies a completion handler. 2017-01-10 21:41:28 +00:00
vfs_cache.c cache: sprinkle __predict_false 2016-12-29 16:35:49 +00:00
vfs_cluster.c Move bogus_page declaration to vm_page.h and initialization to vm_page.c. 2017-01-04 22:27:19 +00:00
vfs_default.c Do not allocate struct statfs on kernel stack. 2017-01-05 17:19:26 +00:00
vfs_export.c Fix build when no INET and INET6 in kernel config. 2016-11-17 16:13:30 +00:00
vfs_extattr.c
vfs_hash.c
vfs_init.c
vfs_lookup.c Fix bug that would result in a kernel crash in some cases involving 2017-01-04 14:43:57 +00:00
vfs_mount.c Do not allocate struct statfs on kernel stack. 2017-01-05 17:19:26 +00:00
vfs_mountroot.c
vfs_subr.c vfs: switch nodes_created, recycles_count and free_owe_inact to counter(9) 2016-12-31 19:59:31 +00:00
vfs_syscalls.c Do not allocate struct statfs on kernel stack. 2017-01-05 17:19:26 +00:00
vfs_vnops.c
vnode_if.src