public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: dhowells@redhat.com, Ingo Molnar <mingo@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Pass mode to wait_on_atomic_t() action funcs and provide default actions
Date: Wed, 01 Nov 2017 18:34:38 +0000	[thread overview]
Message-ID: <15510.1509561278@warthog.procyon.org.uk> (raw)
In-Reply-To: <20171101162713.o7njyehh43jrc5q5@hirez.programming.kicks-ass.net>

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

  reply	other threads:[~2017-11-01 18:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 15:37 [PATCH] Pass mode to wait_on_atomic_t() action funcs and provide default actions David Howells
2017-11-01 16:27 ` Peter Zijlstra
2017-11-01 18:34   ` David Howells [this message]
2017-11-01 19:06     ` Peter Zijlstra
2017-11-02 16:45       ` David Howells
2017-11-02 16:48         ` Peter Zijlstra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15510.1509561278@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox