]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
LinuxKPI: Implement kthread_worker related functions
authorVladimir Kondratyev <wulf@FreeBSD.org>
Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)
committerVladimir Kondratyev <wulf@FreeBSD.org>
Tue, 17 May 2022 12:10:20 +0000 (15:10 +0300)
commitb6f87b78b5bb48e00f54b96ddea7ad5bf5e3aa1f
tree6cf336cd13740e3dc9c60abc3f993056a9ef5563
parent0093bc3cd17c2f657682258fae73737655b8a573
LinuxKPI: Implement kthread_worker related functions

Kthread worker is a single thread workqueue which can be used in cases
where specific kthread association is necessary, for example, when it
should have RT priority or be assigned to certain cgroup.

This change implements Linux v4.9 interface which mostly hides kthread
internals from users thus allowing to use ordinary taskqueue(9) KPI.
As kthread worker prohibits enqueueing of already pending or canceling
tasks some minimal changes to taskqueue(9) were done.
taskqueue_enqueue_flags() was added to taskqueue KPI which accepts extra
flags parameter. It contains one or more of the following flags:

TASKQUEUE_FAIL_IF_PENDING - taskqueue_enqueue_flags() fails if the task
    is already scheduled to execution. EEXIST is returned and the
    ta_pending counter value remains unchanged.
TASKQUEUE_FAIL_IF_CANCELING - taskqueue_enqueue_flags() fails if the
    task is in the canceling state and ECANCELED is returned.

Required by: drm-kmod 5.10

MFC after: 1 week
Reviewed by: hselasky, Pau Amma (docs)
Differential Revision: https://reviews.freebsd.org/D35051
share/man/man9/taskqueue.9
sys/compat/linuxkpi/common/include/linux/kthread.h
sys/compat/linuxkpi/common/src/linux_kthread.c
sys/kern/subr_taskqueue.c
sys/sys/taskqueue.h