Messages in this thread | | | Date | Sat, 14 Apr 2012 05:39:53 +0200 | From | Oleg Nesterov <> | Subject | Re: [PATCH v4 1/3] task_work_add: generic process-context callbacks |
| |
probably I should also comment this part...
On 04/13, Linus Torvalds wrote: > > Alternatively, you must make the rule be that the data can only be > freed by the caller *if* it was returned from "task_work_cancel()".
Exactly.
Once the caller does task_work_add(twork), it no longer "owns" this twork.
But, if task_work_cancel() succeeds - you own it again.
> But then you can't allocate it on the stack any more, and have to > allocate it separately.
Yes, unless you do task_work_add/cancel(current).
Oleg.
| |