CVS log for src/sys/kern/kern_threadpool.c
Up to [cvs.NetBSD.org] / src / sys / kern
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Revision 1.19.2.1: download - view: text, markup, annotated - select for diffs
Sat Apr 3 22:29:00 2021 UTC (4 years ago) by thorpej
Branches: thorpej-futex
Diff to: previous 1.19: preferred, colored; next MAIN 1.20: preferred, colored
Changes since revision 1.19: +102 -81
lines
Sync with HEAD.
Revision 1.15.6.1: download - view: text, markup, annotated - select for diffs
Mon Jan 25 14:12:50 2021 UTC (4 years, 3 months ago) by martin
Branches: netbsd-9
CVS tags: netbsd-9-4-RELEASE,
netbsd-9-3-RELEASE,
netbsd-9-2-RELEASE
Diff to: previous 1.15: preferred, colored; next MAIN 1.16: preferred, colored
Changes since revision 1.15: +4 -3
lines
Pull up following revision(s) (requested by riastradh in ticket #1187):
sys/kern/kern_threadpool.c: revision 1.23
threadpool(9): Fix synchronization between cancel and dispatch.
- threadpool_cancel_job_async tried to prevent
threadpool_dispatcher_thread from taking the job by setting
job->job_thread = NULL and then removing the job from the queue.
- But threadpool_cancel_job_async didn't notice job->job_thread is
null until after it also removes the job from the queue =>
double-remove, *boom*.
The solution is to teach threadpool_dispatcher_thread to wait until
it has acquired the job lock to test whether job->job_thread is still
valid before it decides to remove the job from the queue.
Fixes PR kern/55948.
XXX pullup-9
Revision 1.23: download - view: text, markup, annotated - select for diffs
Sat Jan 23 16:33:49 2021 UTC (4 years, 3 months ago) by riastradh
Branches: MAIN
CVS tags: thorpej-ifq-base,
thorpej-ifq,
thorpej-i2c-spi-conf2-base,
thorpej-i2c-spi-conf2,
thorpej-i2c-spi-conf-base,
thorpej-i2c-spi-conf,
thorpej-futex2-base,
thorpej-futex2,
thorpej-futex-base,
thorpej-cfargs2-base,
thorpej-cfargs2,
thorpej-cfargs-base,
thorpej-cfargs,
thorpej-altq-separation-base,
thorpej-altq-separation,
perseant-exfatfs-base-20240630,
perseant-exfatfs-base,
perseant-exfatfs,
netbsd-10-base,
netbsd-10-1-RELEASE,
netbsd-10-0-RELEASE,
netbsd-10-0-RC6,
netbsd-10-0-RC5,
netbsd-10-0-RC4,
netbsd-10-0-RC3,
netbsd-10-0-RC2,
netbsd-10-0-RC1,
netbsd-10,
cjep_sun2x-base1,
cjep_sun2x-base,
cjep_sun2x,
cjep_staticlib_x-base1,
cjep_staticlib_x-base,
cjep_staticlib_x,
bouyer-sunxi-drm-base,
bouyer-sunxi-drm,
HEAD
Diff to: previous 1.22: preferred, colored
Changes since revision 1.22: +4 -3
lines
threadpool(9): Fix synchronization between cancel and dispatch.
- threadpool_cancel_job_async tried to prevent
threadpool_dispatcher_thread from taking the job by setting
job->job_thread = NULL and then removing the job from the queue.
- But threadpool_cancel_job_async didn't notice job->job_thread is
null until after it also removes the job from the queue =>
double-remove, *boom*.
The solution is to teach threadpool_dispatcher_thread to wait until
it has acquired the job lock to test whether job->job_thread is still
valid before it decides to remove the job from the queue.
Fixes PR kern/55948.
XXX pullup-9
Revision 1.22: download - view: text, markup, annotated - select for diffs
Wed Jan 13 07:34:37 2021 UTC (4 years, 3 months ago) by skrll
Branches: MAIN
Diff to: previous 1.21: preferred, colored
Changes since revision 1.21: +3 -3
lines
Improve english in a comment
Revision 1.21: download - view: text, markup, annotated - select for diffs
Wed Jan 13 02:20:15 2021 UTC (4 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.20: preferred, colored
Changes since revision 1.20: +92 -78
lines
threadpool(9): Tidy up thread naming.
- `dispatcher', not `overseer' -- much more appropriate metaphor.
- Just omit `/-1' from unbound thread names.
- Just omit `@-1' from dynamic-priority (PRI_NONE) thread names.
Revision 1.20: download - view: text, markup, annotated - select for diffs
Wed Jan 13 02:19:08 2021 UTC (4 years, 3 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.19: preferred, colored
Changes since revision 1.19: +10 -4
lines
threadpool(9): Make threadpool_percpu_ref_remote non-sleepable.
Needed for threadpool-based workqueue_enqueue to run in interrupt
context.
Revision 1.19: download - view: text, markup, annotated - select for diffs
Mon Sep 7 01:08:27 2020 UTC (4 years, 7 months ago) by riastradh
Branches: MAIN
Branch point for: thorpej-futex
Diff to: previous 1.18: preferred, colored
Changes since revision 1.18: +11 -22
lines
threadpool: Simplify job reference-counting logic.
Use atomic_load_relaxed while here.
Revision 1.18: download - view: text, markup, annotated - select for diffs
Sat Apr 25 17:43:23 2020 UTC (5 years ago) by thorpej
Branches: MAIN
Diff to: previous 1.17: preferred, colored
Changes since revision 1.17: +8 -3
lines
Take the ASSERT_SLEEPABLE() out of threadpool_cancel_job() and add a
comment explaining why we can't make that assertion there.
Revision 1.15.4.3: download - view: text, markup, annotated - select for diffs
Wed Apr 8 14:08:51 2020 UTC (5 years ago) by martin
Branches: phil-wifi
Diff to: previous 1.15.4.2: preferred, colored; branchpoint 1.15: preferred, colored; next MAIN 1.16: preferred, colored
Changes since revision 1.15.4.2: +181 -101
lines
Merge changes from current as of 20200406
Revision 1.15.8.1: download - view: text, markup, annotated - select for diffs
Sat Feb 29 20:21:03 2020 UTC (5 years, 1 month ago) by ad
Branches: ad-namecache
Diff to: previous 1.15: preferred, colored; next MAIN 1.16: preferred, colored
Changes since revision 1.15: +181 -101
lines
Sync with head.
Revision 1.17: download - view: text, markup, annotated - select for diffs
Sun Feb 9 22:57:39 2020 UTC (5 years, 2 months ago) by riastradh
Branches: MAIN
CVS tags: phil-wifi-20200421,
phil-wifi-20200411,
phil-wifi-20200406,
is-mlppp-base,
is-mlppp,
bouyer-xenpvh-base2,
bouyer-xenpvh-base1,
bouyer-xenpvh-base,
bouyer-xenpvh,
ad-namecache-base3
Diff to: previous 1.16: preferred, colored
Changes since revision 1.16: +126 -46
lines
Switch from ad-hoc logging to dtrace probes.
Revision 1.16: download - view: text, markup, annotated - select for diffs
Sun Feb 9 22:57:26 2020 UTC (5 years, 2 months ago) by riastradh
Branches: MAIN
Diff to: previous 1.15: preferred, colored
Changes since revision 1.15: +57 -57
lines
Teach threadpool(9) to use percpu_create, mostly.
Revision 1.15.4.2: download - view: text, markup, annotated - select for diffs
Mon Jun 10 22:09:03 2019 UTC (5 years, 10 months ago) by christos
Branches: phil-wifi
Diff to: previous 1.15.4.1: preferred, colored; branchpoint 1.15: preferred, colored
Changes since revision 1.15.4.1: +1082 -0
lines
Sync with HEAD
Revision 1.3.2.3: download - view: text, markup, annotated - select for diffs
Fri Jan 18 08:50:57 2019 UTC (6 years, 3 months ago) by pgoyette
Branches: pgoyette-compat
CVS tags: pgoyette-compat-merge-20190127
Diff to: previous 1.3.2.2: preferred, colored; branchpoint 1.3: preferred, colored; next MAIN 1.4: preferred, colored
Changes since revision 1.3.2.2: +224 -227
lines
Synch with HEAD
Revision 1.15.4.1
Thu Jan 17 10:18:52 2019 UTC (6 years, 3 months ago) by christos
Branches: phil-wifi
FILE REMOVED
Changes since revision 1.15: +0 -1082
lines
file kern_threadpool.c was added on branch phil-wifi on 2019-06-10 22:09:03 +0000
Revision 1.15: download - view: text, markup, annotated - select for diffs
Thu Jan 17 10:18:52 2019 UTC (6 years, 3 months ago) by hannken
Branches: MAIN
CVS tags: phil-wifi-20191119,
phil-wifi-20190609,
pgoyette-compat-20190127,
pgoyette-compat-20190118,
netbsd-9-base,
netbsd-9-1-RELEASE,
netbsd-9-0-RELEASE,
netbsd-9-0-RC2,
netbsd-9-0-RC1,
isaki-audio2-base,
isaki-audio2,
ad-namecache-base2,
ad-namecache-base1,
ad-namecache-base
Branch point for: phil-wifi,
netbsd-9,
ad-namecache
Diff to: previous 1.14: preferred, colored
Changes since revision 1.14: +3 -3
lines
Use PRIu64 for "uint64_t tp_refcnt".
Revision 1.14: download - view: text, markup, annotated - select for diffs
Sat Dec 29 04:39:14 2018 UTC (6 years, 3 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.13: preferred, colored
Changes since revision 1.13: +53 -5
lines
Expose the worker thread idle timeout via sysctl as "kern.threadpool.idle_ms".
Revision 1.13: download - view: text, markup, annotated - select for diffs
Fri Dec 28 00:15:57 2018 UTC (6 years, 3 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.12: preferred, colored
Changes since revision 1.12: +31 -24
lines
Fix job reference counting:
- threadpool_job_hold() no longer returns failure on overflow; it
asserts that overflow doesn't happen.
- threadpool_job_rele() must be called with the job lock held.
- Always grab a reference count on the job in threadpool_schedule_job()
if we're going to do any work.
- Drop that reference count directly in threadpool_job_done(); it's not
safe to dereference the job structure after the job function has called it.
- In the overseer thread, when handing off the job to work thread, hold an
extra reference briefly, as there's a window where we hold neither the
pool lock or the job lock, and without this extra reference, the job could
be snatched away.
Revision 1.12: download - view: text, markup, annotated - select for diffs
Thu Dec 27 04:45:29 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.11: preferred, colored
Changes since revision 1.11: +22 -11
lines
Restore curlwp->l_name in threadpool_job_done(), rather than after the
job function has returned. This lays the groundwork for some job object
reference counting change that will be coming in a subsequent comment.
Revision 1.11: download - view: text, markup, annotated - select for diffs
Wed Dec 26 22:16:26 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.10: preferred, colored
Changes since revision 1.10: +3 -25
lines
Rather than performing lazy initialization, statically initialize early
in the respective kernel startup routines.
Revision 1.10: download - view: text, markup, annotated - select for diffs
Wed Dec 26 21:43:39 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.9: preferred, colored
Changes since revision 1.9: +3 -3
lines
Adjust the definition of threadpool_job_fn_t to reflect Taylor's original
intent. (The original didn't compile, and I'm not a very good mind reader.)
Revision 1.9: download - view: text, markup, annotated - select for diffs
Wed Dec 26 21:25:51 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.8: preferred, colored
Changes since revision 1.8: +20 -19
lines
Whitespace tweaks.
Revision 1.8: download - view: text, markup, annotated - select for diffs
Wed Dec 26 21:18:51 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.7: preferred, colored
Changes since revision 1.7: +3 -4
lines
Stylistic tweak to previous.
Revision 1.7: download - view: text, markup, annotated - select for diffs
Wed Dec 26 21:15:50 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.6: preferred, colored
Changes since revision 1.6: +21 -40
lines
Simplify thread reference counting of the thread pool object.
Revision 1.6: download - view: text, markup, annotated - select for diffs
Wed Dec 26 20:30:36 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.5: preferred, colored
Changes since revision 1.5: +27 -24
lines
Make the callers of threadpool_create() and threadpool_destroy()
responsibile for managing their own storage.
Revision 1.5: download - view: text, markup, annotated - select for diffs
Wed Dec 26 20:08:22 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.4: preferred, colored
Changes since revision 1.4: +10 -18
lines
Use uint64_t for the unbound and per-cpu thread pool ref counts; they're
always manipulated under a lock. Rather than bother returning EBUSY,
just assert that the ref count never overlows (if it ever does, you have
bigger problems).
Revision 1.4: download - view: text, markup, annotated - select for diffs
Wed Dec 26 18:54:19 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Diff to: previous 1.3: preferred, colored
Changes since revision 1.3: +64 -87
lines
- De-opaque'ify struct threadpool_job.
- De-_t'ify all of the structure types.
No functional chage, no ABI change (verified with old rump unit test
before and after new librump.so).
Per Taylor's request.
Revision 1.3.2.2: download - view: text, markup, annotated - select for diffs
Wed Dec 26 14:02:04 2018 UTC (6 years, 4 months ago) by pgoyette
Branches: pgoyette-compat
Diff to: previous 1.3.2.1: preferred, colored; branchpoint 1.3: preferred, colored
Changes since revision 1.3.2.1: +1085 -0
lines
Sync with HEAD, resolve a few conflicts
Revision 1.3.2.1
Tue Dec 25 05:44:13 2018 UTC (6 years, 4 months ago) by pgoyette
Branches: pgoyette-compat
FILE REMOVED
Changes since revision 1.3: +0 -1085
lines
file kern_threadpool.c was added on branch pgoyette-compat on 2018-12-26 14:02:04 +0000
Revision 1.3: download - view: text, markup, annotated - select for diffs
Tue Dec 25 05:44:13 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
CVS tags: pgoyette-compat-1226
Branch point for: pgoyette-compat
Diff to: previous 1.2: preferred, colored
Changes since revision 1.2: +3 -10
lines
Ho ho ho! We can suppress that warning with __diagused! Merry Christmas!
Revision 1.2: download - view: text, markup, annotated - select for diffs
Tue Dec 25 02:17:07 2018 UTC (6 years, 4 months ago) by kre
Branches: MAIN
Diff to: previous 1.1: preferred, colored
Changes since revision 1.1: +11 -4
lines
Fix !DIAGNOSTIC builds.
Revision 1.1: download - view: text, markup, annotated - select for diffs
Mon Dec 24 16:58:54 2018 UTC (6 years, 4 months ago) by thorpej
Branches: MAIN
Add threadpool(9), an abstraction that provides shared pools of kernel
threads running at specific priorities, with support for unbound pools
and per-cpu pools.
Written by riastradh@, and based on the May 2014 draft, with a few changes
by me:
- Working on the assumption that a relative few priorities will actually
be used, reduce the memory footprint by using linked lists, rather than
2 large (and mostly empty) tables. The performance impact is essentially
nil, since these lists are consulted only when pools are created (and
destroyed, for DIAGNOSTIC checks), and the lists will have at most 225
entries.
- Make threadpool job object, which the caller must allocate storage for,
really opaque.
- Use typedefs for the threadpool types, to reduce the verbosity of the
API somewhat.
- Fix a bunch of pool / worker thread / job object lifecycle bugs.
Also include an ATF unit test, written by me, that exercises the basics
of the API by loading a kernel module that exposes several sysctls that
allow the ATF test script to create and destroy threadpools, schedule a
basic job, and verify that it ran.
And thus NetBSD 8.99.29 has arrived.
CVSweb <webmaster@jp.NetBSD.org>