From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755835AbdKBQsO (ORCPT ); Thu, 2 Nov 2017 12:48:14 -0400 Received: from merlin.infradead.org ([205.233.59.134]:34428 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755274AbdKBQsM (ORCPT ); Thu, 2 Nov 2017 12:48:12 -0400 Date: Thu, 2 Nov 2017 17:48:08 +0100 From: Peter Zijlstra To: David Howells Cc: Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Pass mode to wait_on_atomic_t() action funcs and provide default actions Message-ID: <20171102164808.zelswfla2coczmhy@hirez.programming.kicks-ass.net> References: <20171101190644.chwhfpoz3ywxx2m7@hirez.programming.kicks-ass.net> <20171101162713.o7njyehh43jrc5q5@hirez.programming.kicks-ass.net> <5838.1509550663@warthog.procyon.org.uk> <15510.1509561278@warthog.procyon.org.uk> <10660.1509641151@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <10660.1509641151@warthog.procyon.org.uk> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 02, 2017 at 04:45:51PM +0000, David Howells wrote: > Peter Zijlstra wrote: > > > > The moment atomic_dec_and_test() is called, *net is at liberty to disappear, > > > so there's no way to find a waitqueue - unless that waitqueue is guaranteed > > > not to be deallocated, eg. by being global. > > > > But any possible wait side will still need to dereference *net at an > > indeterminate point in the future to ascertain the value does now indeed > > read 0. > > Yeah, the assumption is that the *wait* side is where the deallocation is > happening. So I have something like: > > net->live = false; // Tell the cell managers to delete the cells > ... > foreach (cell) > queue_work(cell); > ... > wait_on_atomic_t(&net->cells_outstanding, atomic_t_wait, > TASK_UNINTERRUPTIBLE); > ... > destroy(net); > > > ... We can certainly start with your patch, as that does clean things up. > > Can I put that down as a Grudgingly-acked-by? Yeah sure ;-)