Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1726723
| From | Tejun Heo <tj@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC PATCH 01/11] workqueue: Add a decrement-after-return and wake if 0 facility |
| Date | 2017-09-05 15:40 +0200 |
| Message-ID | <ummf7-3dY-1@gated-at.bofh.it> (permalink) |
| References | <ukWmK-71s-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hello, David. On Fri, Sep 01, 2017 at 04:40:53PM +0100, David Howells wrote: > Add a facility to the workqueue subsystem whereby an atomic_t can be > registered by a work function such that the work function dispatcher will > decrement the atomic after the work function has returned and then call > wake_up_atomic() on it if it reached 0. > > This is analogous to complete_and_exit() for kernel threads and is used to > avoid a race between notifying that a work item is about to finish and the > .text segment from a module being discarded. > > The way this is used is that the work function calls: > > dec_after_work(atomic_t *counter); > > to register the counter and then process_one_work() calls it, potentially > wakes it and clears the registration. > > The reason I've used an atomic_t rather than a completion is that (1) it > takes up less space and (2) it can monitor multiple objects. Given how work items are used, I think this is too inviting to abuses where people build complex event chains through these counters and those chains would be completely opaque. If the goal is protecting .text of a work item, can't we just do that? Can you please describe your use case in more detail? Why can't it be done via the usual "flush from exit"? Thanks. -- tejun
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC PATCH 01/11] workqueue: Add a decrement-after-return and wake if 0 facility David Howells <dhowells@redhat.com> - 2017-09-01 17:50 +0200
[RFC PATCH 00/11] AFS: Namespacing part 1 David Howells <dhowells@redhat.com> - 2017-09-01 18:00 +0200
Re: [RFC PATCH 01/11] workqueue: Add a decrement-after-return and wake if 0 facility Tejun Heo <tj@kernel.org> - 2017-09-05 15:40 +0200
Re: [RFC PATCH 01/11] workqueue: Add a decrement-after-return and wake if 0 facility David Howells <dhowells@redhat.com> - 2017-09-05 17:00 +0200
Re: [RFC PATCH 01/11] workqueue: Add a decrement-after-return and wake if 0 facility Tejun Heo <tj@kernel.org> - 2017-09-06 17:00 +0200
csiph-web