Page MenuHomeFreeBSD

LinuxKPI: Implement kthread_worker related functions
ClosedPublic

Authored by wulf on Apr 24 2022, 11:42 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 14, 11:01 PM
Unknown Object (File)
Feb 12 2024, 3:36 PM
Unknown Object (File)
Jan 20 2024, 7:59 AM
Unknown Object (File)
Jan 14 2024, 9:00 AM
Unknown Object (File)
Dec 21 2023, 7:59 PM
Unknown Object (File)
Dec 20 2023, 3:19 AM
Unknown Object (File)
Nov 7 2023, 7:47 PM
Unknown Object (File)
Oct 16 2023, 9:51 AM

Details

Summary

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
parameter called flags which supports following values:

TQFLG_FAILIF_CANCELING - taskqueue_enqueue_flags() fails if task is in

canceling state returning ECANCELED to caller.

TQFLG_FAILIF_PENDING - taskqueue_enqueue_flags() fails if task is already

scheduled to execution. EEXIST is returned to caller in that case and
ta_pending counter value remains the same.

TBD: manpage update.

Required by: drm-kmod 5.10

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 45408
Build 42296: arc lint + arc unit

Event Timeline

wulf requested review of this revision.Apr 24 2022, 11:42 PM
sys/kern/subr_taskqueue.c
129

Please expand this macro before commit.

244

Maybe use __predict_false() here.

256

ditto

sys/sys/taskqueue.h
65

Name this TASKQUEUE_FAIL_IF_PENDING and TASKQUEUE_FAIL_IF_CANCELING

90

flags -> fail_flags ?

  • task_is_running() macro is expanded
  • flags renamed to TASKQUEUE_FAIL_IF_PENDING and TASKQUEUE_FAIL_IF_CANCELING
  • __predict_false() added to taskqueue_enqueue ifs
  • manpage
wulf marked 4 inline comments as done.Apr 25 2022, 8:37 PM

Looks good!

Update commit message and add manual pages changes.

This revision is now accepted and ready to land.Apr 26 2022, 6:44 AM
pauamma_gundo.com added inline comments.
share/man/man9/taskqueue.9
231
239
241
246
This revision now requires changes to proceed.Apr 27 2022, 1:48 AM
wulf marked 4 inline comments as done.Apr 27 2022, 9:11 PM

fix manpage according to @pauamma request

This revision is now accepted and ready to land.Apr 27 2022, 11:46 PM