From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756954Ab2HTPKp (ORCPT ); Mon, 20 Aug 2012 11:10:45 -0400 Received: from casper.infradead.org ([85.118.1.10]:54963 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756790Ab2HTPKn convert rfc822-to-8bit (ORCPT ); Mon, 20 Aug 2012 11:10:43 -0400 Message-ID: <1345475434.23018.48.camel@twins> Subject: Re: lockdep trace from posix timers From: Peter Zijlstra To: Oleg Nesterov Cc: Dave Jones , Linux Kernel , Thomas Gleixner , rostedt , dhowells , Al Viro Date: Mon, 20 Aug 2012 17:10:34 +0200 In-Reply-To: <20120820145919.GB18499@redhat.com> References: <20120724203613.GA9637@redhat.com> <1345140478.29668.54.camel@twins> <20120817151447.GA7918@redhat.com> <1345446957.23018.14.camel@twins> <1345463081.23018.34.camel@twins> <20120820145919.GB18499@redhat.com> Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7BIT X-Mailer: Evolution 3.2.2- Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2012-08-20 at 16:59 +0200, Oleg Nesterov wrote: > On 08/20, Peter Zijlstra wrote: > > > > task_work_cancel(struct task_struct *task, task_work_func_t func) > > { > > ... > > + > > +again: > > + workp = &task->task_works; > > + work = *workp; > > + while (work) { > > + if (work->func == func) { > > But this all can race with task_work_run() if task != current. > > This "work" can be freed/reused. And it should only return !NULL > if twork->func() was not called. Ah, because we could be iterating the list after the xchg done by run. Hmm..