Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755583AbbKWW1K (ORCPT ); Mon, 23 Nov 2015 17:27:10 -0500 Received: from mail-yk0-f172.google.com ([209.85.160.172]:33800 "EHLO mail-yk0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754473AbbKWW1I (ORCPT ); Mon, 23 Nov 2015 17:27:08 -0500 Date: Mon, 23 Nov 2015 17:27:03 -0500 From: Tejun Heo To: Petr Mladek Cc: Andrew Morton , Oleg Nesterov , Ingo Molnar , Peter Zijlstra , Steven Rostedt , "Paul E. McKenney" , Josh Triplett , Thomas Gleixner , Linus Torvalds , Jiri Kosina , Borislav Petkov , Michal Hocko , linux-mm@kvack.org, Vlastimil Babka , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 07/22] kthread: Detect when a kthread work is used by more workers Message-ID: <20151123222703.GH19072@mtj.duckdns.org> References: <1447853127-3461-1-git-send-email-pmladek@suse.com> <1447853127-3461-8-git-send-email-pmladek@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1447853127-3461-8-git-send-email-pmladek@suse.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 752 Lines: 26 Hello, On Wed, Nov 18, 2015 at 02:25:12PM +0100, Petr Mladek wrote: > @@ -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 from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/