Thread (49 messages) 49 messages, 9 authors, 2016-01-14

Re: [PATCH v3 07/22] kthread: Detect when a kthread work is used by more workers

From: Tejun Heo <tj@kernel.org>
Date: 2015-11-23 22:27:10
Also in: linux-mm, lkml

Hello,

On Wed, Nov 18, 2015 at 02:25:12PM +0100, Petr Mladek wrote:
quoted hunk ↗ jump to hunk
@@ -610,6 +625,12 @@ repeat:
 	if (work) {
 		__set_current_state(TASK_RUNNING);
 		work->func(work);
+
+		spin_lock_irq(&worker->lock);
+		/* Allow to queue the work into another worker */
+		if (!kthread_work_pending(work))
+			work->worker = NULL;
+		spin_unlock_irq(&worker->lock);
Doesn't this mean that the work item can't be freed from its callback?
That pattern tends to happen regularly.

Thanks.

-- 
tejun

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help