All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>, Tejun Heo <tj@kernel.org>,
	computersforpeace@gmail.com, Ingo Molnar <mingo@kernel.org>,
	der.herr@hofr.at
Subject: Re: complete_all and "forever" completions
Date: Wed, 26 Oct 2016 10:45:35 +0200	[thread overview]
Message-ID: <20161026084535.GX3102@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20161025223054.GA22917@dtor-ws>

On Tue, Oct 25, 2016 at 03:30:54PM -0700, Dmitry Torokhov wrote:
> Hi,
> 
> Reading Documentation/scheduler/completion.txt, complete_all() is

Oh, there is documentation? /me goes read.

> supposed to be usable with "forever" completions, i.e. when we have an
> action that happens once and stays "done" for the rest of lifetime of an
> object, no matter how many times we check for "doneness".

I suppose you allude to this wording:

  "calls complete_all() to signal all current and future waiters."

> However the
> implementation for complete_all() simply sets the counter to be greater
> or equal UINT_MAX/2 and do_wait_for_common() happily decreases it on
> every call.

This is indeed so.

> Is it simply an artefact of [older] implementation where we do not
> expect to make that many calls to wait_for_completion*() so that
> completion that is signalled with ocmplete_all() is practically stays
> signalled forever?

The text says it was written against v3.18 or thereabout, and that
implementation looks a lot like todays, so I doubt it ever worked like
that.

> Or do we need something like this in
> do_wait_for_common():
> 
> 	if (x->done < UINT_MAX/2)
> 		x->done--;

Depends a bit, do you really want this? Seems a bit daft to keep asking
if its done already, seems like a waste of cycles to me.

  reply	other threads:[~2016-10-26  8:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 22:30 complete_all and "forever" completions Dmitry Torokhov
2016-10-26  8:45 ` Peter Zijlstra [this message]
2016-10-26  9:15   ` Nicholas Mc Guire
2016-10-27  9:51     ` Daniel Wagner
2016-10-26 12:10   ` Dmitry Torokhov
2016-10-26 15:42     ` Peter Zijlstra
2016-10-26 15:46       ` Peter Zijlstra
2016-10-26 17:12       ` Nicholas Mc Guire
2016-10-26 17:20         ` Dmitry Torokhov
2016-10-26 18:23       ` Dmitry Torokhov

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=20161026084535.GX3102@twins.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=computersforpeace@gmail.com \
    --cc=der.herr@hofr.at \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tj@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.