From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751957AbdGEQSS (ORCPT ); Wed, 5 Jul 2017 12:18:18 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:49888 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751890AbdGEQSR (ORCPT ); Wed, 5 Jul 2017 12:18:17 -0400 Date: Wed, 5 Jul 2017 18:18:00 +0200 From: Peter Zijlstra To: "Luis R. Rodriguez" Cc: Linus Torvalds , Thomas Gleixner , DanielWagnerwagi@monom.org, Boqun Feng , Marcelo Tosatti , Paul Gortmaker , Ming Lei , yi1.li@linux.intel.com, takahiro.akashi@linaro.org, Jakub Kicinski , Greg Kroah-Hartman , "Paul E. McKenney" , Davidlohr Bueso , Linux Kernel Mailing List , ebiederm@xmission.com, pmladek@suse.com, luto@kernel.org, keescook@chromium.org, dhowells@redhat.com, alan@linux.intel.com, tytso@mit.edu, oss-drivers@netronome.com Subject: Re: [PATCH] firmware: wake all waiters Message-ID: <20170705161800.wnrrbgpxsrtltxxc@hirez.programming.kicks-ass.net> References: <20170623233702.20564-1-jakub.kicinski@netronome.com> <20170626233030.GI21846@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170626233030.GI21846@wotan.suse.de> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 27, 2017 at 01:30:30AM +0200, Luis R. Rodriguez wrote: > > But the *only* reason for swait is extreme memory issues and some very > > special realtime issues, where it saves a couple of bytes in > > structures that need close packing, and doesn't even use normal > > spinlocks, so it saves a couple of cycles at wakeup/sleep because it > > doesn't do a good job in general. Yes, its about real-time. But it shouldn't be _that_ special purpose. So swait should be capable of most things people want from a waitqueue. Things it explicitly does not do are things like: - custom wake functions - exclusive mode - mixing different sleep types on a queue (which I would recommend against in any case). But only very few people need those. > > The "avoid normal spinlocks" is because it is meant for code that is > > *so* special that it needs the magical low-level raw spinlocks. > > I think the two valid users are RCU (which needed it for RT), and kvm > > (which also needed it for similar issues - it needs to be > > non-preemptible). Right, so we need the raw_spinlock in order to run from non-preemptible code on RT. And we then also need bounded runtimes on stuff. The only function which is affected by that is swake_up_all(), that does an unbounded list iteration and is therefore required to be called from the schedulable context (so we can drop the lock and gain bounds on the preemption latency). But aside of all that, it should provide 'everything' people want from a bog standard regular waitqueue. So I don't see why people shouldn't use it more. In any case, I'm not seeing why you call it idiotic.