From: Oleg Nesterov <oleg@redhat.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Paul McKenney <paulmck@linux.vnet.ibm.com>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC] introduce prepare_to_wait_event()
Date: Tue, 1 Oct 2013 19:33:37 +0200 [thread overview]
Message-ID: <20131001173337.GA16890@redhat.com> (raw)
In-Reply-To: <20131001172504.GV3657@laptop.programming.kicks-ass.net>
On 10/01, Peter Zijlstra wrote:
>
> On Tue, Oct 01, 2013 at 07:01:37PM +0200, Oleg Nesterov wrote:
> > if (exclusive) \
> > __wait.flags = WQ_FLAG_EXCLUSIVE; \
> > else \
> > __wait.flags = 0; \
>
> __wait.flags = exclusive * WQ_FLAG_EXCLUSIVE;
>
> or is that too obscure? ;-)
I do not mind ;) The generated code should be the same.
> > for (;;) { \
> > long intr = prepare_to_wait_event(&wq, &__wait, state); \
>
> int __intr = ...;
>
> The interruptible bit doesn't actually need long;
Yes, it can be even "bool", but see below.
> and local variables
> have __ prefixes in this context.
Yes, yes, will fix.
> > if (condition) \
> > break; \
> > \
> > if (___wait_is_interruptible(state) && intr) { \
> > __ret = intr; \
Since typeof(__ret) == typeof(intr) gcc can (likely) simply do "mov r1, r2",
so "long intr" make the code better.
I am not saying that "int intr" can make it worse, but to me "long" looks
better in this context. But I wouldn't mind to change this.
> > Compiler should optimize out "long intr" if !interruptible/killable.
>
> Yeah, and I think even the if (0 && __intr) would suffice for the unused
> check; otherwise we'd have to adorn the thing with __maybe_unused.
Hmm yes, I didn't see any warning during the compilation, but perhaps
__maybe_unused is needed, thanks.
> > What do you think?
>
> That would actually work I think.. the ___wait_is_interruptible() nicely
> does away with the unused code; the only slightly more expensive thing
> would be the prepare_to_wait_event() thing.
>
> And if that really turns out to be a problem we could even re-use
> ___wait_is_interruptible() to call prepare_to_wait() instead.
OK, thanks.
So I'll wait until your series is applied the resend it officially.
Oleg.
next prev parent reply other threads:[~2013-10-01 17:40 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-30 15:22 [PATCH 0/6] sched, wait: Collapse __wait_event macros -v4 Peter Zijlstra
2013-09-30 15:22 ` [PATCH 1/6] sched, wait: Make the signal_pending() checks consistent Peter Zijlstra
2013-09-30 15:22 ` [PATCH 2/6] sched, wait: Change timeout logic Peter Zijlstra
2013-09-30 15:48 ` Linus Torvalds
2013-09-30 16:09 ` Peter Zijlstra
2013-09-30 15:22 ` [PATCH 3/6] sched, wait: Change the wait_exclusive control flow Peter Zijlstra
2013-09-30 15:22 ` [PATCH 4/6] sched, wait: Collapse __wait_event macros Peter Zijlstra
2013-09-30 15:22 ` [PATCH 5/6] sched, wait: Also use ___wait_event() for __wait_event_hrtimeout Peter Zijlstra
2013-09-30 15:22 ` [PATCH 6/6] sched, wait: Make the __wait_event*() interface more friendly Peter Zijlstra
2013-10-01 6:39 ` Ingo Molnar
2013-09-30 15:50 ` [PATCH 0/6] sched, wait: Collapse __wait_event macros -v4 Linus Torvalds
2013-09-30 16:11 ` Peter Zijlstra
2013-09-30 17:40 ` Oleg Nesterov
2013-09-30 18:00 ` Oleg Nesterov
2013-09-30 18:09 ` Peter Zijlstra
2013-09-30 18:13 ` Oleg Nesterov
2013-10-01 14:09 ` Oleg Nesterov
2013-10-01 14:39 ` Peter Zijlstra
2013-10-01 15:16 ` Oleg Nesterov
2013-10-01 17:01 ` [RFC] introduce prepare_to_wait_event() Oleg Nesterov
2013-10-01 17:25 ` Peter Zijlstra
2013-10-01 17:33 ` Oleg Nesterov [this message]
2013-10-01 17:44 ` 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=20131001173337.GA16890@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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