Re: [RFC PATCH 01/11] workqueue: Add a decrement-after-return and wake if 0 facility

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux