From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932937AbdKASel (ORCPT ); Wed, 1 Nov 2017 14:34:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36782 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751712AbdKASek (ORCPT ); Wed, 1 Nov 2017 14:34:40 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 53AA6356C7 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=dhowells@redhat.com Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20171101162713.o7njyehh43jrc5q5@hirez.programming.kicks-ass.net> References: <20171101162713.o7njyehh43jrc5q5@hirez.programming.kicks-ass.net> <5838.1509550663@warthog.procyon.org.uk> To: Peter Zijlstra Cc: dhowells@redhat.com, Ingo Molnar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] Pass mode to wait_on_atomic_t() action funcs and provide default actions MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15509.1509561278.1@warthog.procyon.org.uk> Date: Wed, 01 Nov 2017 18:34:38 +0000 Message-ID: <15510.1509561278@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 01 Nov 2017 18:34:40 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Peter Zijlstra wrote: > > I'd like to propose this change for the next merge window. One question, > > though: rather than providing an exported default function, should the > > default be used automatically if a NULL function pointer is passed? > > > > The default being atomic_t_wait? Yes. > FWIW, I think the whole wait_atomic_t thing is an utter piece of crap > that should be killed out right. It uses this hashed waitqueue crap and > does not in fact do anything with the variable that needs it to be > atomic_t. What would you replace it with? Bear in mind that the atomic_t may have been deallocated by the time wake_up_atomic_t() is called. I'm using it like: static void afs_dec_cells_outstanding(struct afs_net *net) { if (atomic_dec_and_test(&net->cells_outstanding)) wake_up_atomic_t(&net->cells_outstanding); } 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. David