Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753221AbdF2R6D (ORCPT ); Thu, 29 Jun 2017 13:58:03 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:35851 "EHLO mail-io0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753171AbdF2R5z (ORCPT ); Thu, 29 Jun 2017 13:57:55 -0400 MIME-Version: 1.0 In-Reply-To: <20170629174046.GC3954@linux-80c1.suse> References: <20170614222017.14653-1-mcgrof@kernel.org> <20170614222017.14653-3-mcgrof@kernel.org> <20170629125402.GH26046@kroah.com> <20170629133530.GA14747@kroah.com> <20170629174046.GC3954@linux-80c1.suse> From: Linus Torvalds Date: Thu, 29 Jun 2017 10:57:53 -0700 X-Google-Sender-Auth: PkhMhnWgTHHwHxtsRsVCG5ZDoRw Message-ID: Subject: Re: [PATCH 2/4] swait: add the missing killable swaits To: Davidlohr Bueso Cc: Thomas Gleixner , Greg KH , "Luis R. Rodriguez" , mfuzzey@parkeon.com, "Eric W. Biederman" , Dmitry Torokhov , Daniel Wagner , David Woodhouse , jewalt@lgsinnovations.com, rafal@milecki.pl, Arend Van Spriel , "Rafael J. Wysocki" , "Li, Yi" , atull@kernel.org, Moritz Fischer , Petr Mladek , Johannes Berg , Emmanuel Grumbach , "Coelho, Luciano" , Kalle Valo , Andrew Lutomirski , Kees Cook , "AKASHI, Takahiro" , David Howells , Peter Jones , Hans de Goede , Alan Cox , "Theodore Ts'o" , Michael Kerrisk , Paul Gortmaker , Marcelo Tosatti , Matthew Wilcox , Linux API , linux-fsdevel , Linux Kernel Mailing List , "stable # 4 . 6" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1626 Lines: 43 On Thu, Jun 29, 2017 at 10:40 AM, Davidlohr Bueso wrote: > > For all the above, what do you think of my 'sswait' proposal? I see no actual users of such a specialty interface. I don't think we've *ever* had any actual problems with our current wait-queues, apart from the RT issues, which were not about the waitqueues themselves, but purely about RT itself. So without some very compelling reason, I'd not want to add yet another wait-queue. I actually think swait is pure garbage. Most users only wake up one process anyway, and using swait for that is stupid. If you only wake up one, you might as well just have a single process pointer, not a wait list at all, and then use "wake_up_process()". There is *one* single user of swake_up_all(), and that one looks like bogus crap also: it does it outside of the spinlock that could have been used to protect the queue - p,lus I'm not sure there's really a queue anyway, since I think it's just the grace-period kthread that is there. kvm uses swait, but doesn't use swake_up_all(), so it always just wakes up a single waiter. That may be the right thing to do. Or it's just another bug. I don't know. The KVM use looks broken too, since it does if (swait_active(wqp)) { swake_up(wqp); which is racy wrt new waiters, which implies that there is some upper-level synchronization - possibly the same "only one thread anyway". So swake really looks like crap. It has crap semantics, it has crap users, it's just broken. The last thing we want to do is to create something _else_ specialized like this. Linus