lkml.org 
[lkml]   [2017]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] Pass mode to wait_on_atomic_t() action funcs and provide default actions
Date
Peter Zijlstra <peterz@infradead.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

\
 
 \ /
  Last update: 2017-11-01 19:35    [W:0.055 / U:0.340 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site