[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <15510.1509561278@warthog.procyon.org.uk>
Date: Wed, 01 Nov 2017 18:34:38 +0000
From: David Howells <dhowells@...hat.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: dhowells@...hat.com, Ingo Molnar <mingo@...hat.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] Pass mode to wait_on_atomic_t() action funcs and provide default actions
Peter Zijlstra <peterz@...radead.org> 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
Powered by blists - more mailing lists