]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Fix problem regarding priority inversion when using the concurrency
authorhselasky <hselasky@FreeBSD.org>
Wed, 19 Apr 2017 13:03:29 +0000 (13:03 +0000)
committerhselasky <hselasky@FreeBSD.org>
Wed, 19 Apr 2017 13:03:29 +0000 (13:03 +0000)
commit4c92046c3a0cf817a80b86fb809a7a89b3053198
treee04fbdf58cc5c9dbea9200b48ab925dc9ca417f5
parentf33ee7c6bd3aff3f856bb49f9784b3ccb5dda86d
Fix problem regarding priority inversion when using the concurrency
kit, CK, in the LinuxKPI.

When threads are pinned to a CPU core or when there is only one CPU,
it can happen that a higher priority thread can call the CK
synchronize function while a lower priority thread holds the read
lock. Because the CK's synchronize is a simple wait loop this can lead
to a deadlock situation. To solve this problem use the recently
introduced CK's wait callback function.

When detecting a CK blocking condition figure out the lowest priority
among the blockers and update the calling thread's priority and
yield. If another CPU core is holding the read lock, pin the thread to
the blocked CPU core and update the priority. The calling threads
priority and CPU bindings are restored before return.

If a thread holding a CK read lock is detected to be sleeping, pause()
will be used instead of yield().

MFC after: 1 week
Sponsored by: Mellanox Technologies
sys/compat/linuxkpi/common/include/linux/sched.h
sys/compat/linuxkpi/common/include/linux/srcu.h
sys/compat/linuxkpi/common/src/linux_rcu.c