lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131001173337.GA16890@redhat.com>
Date:	Tue, 1 Oct 2013 19:33:37 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Peter Zijlstra <peterz@...radead.org>
Cc:	Ingo Molnar <mingo@...nel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [RFC] introduce prepare_to_wait_event()

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.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ