Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6650355ybi; Wed, 31 Jul 2019 18:43:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqyDkBlPU3cbm/bhhzQ4WIA7yi5aVYUjY4LLJEK41kgvAgdLzW+1mK11UzvN7weVRRXJ8bdZ X-Received: by 2002:a17:902:124:: with SMTP id 33mr126022494plb.145.1564623814175; Wed, 31 Jul 2019 18:43:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564623814; cv=none; d=google.com; s=arc-20160816; b=qmlTvFJEhX/LqHs6q7dMQgrsaizwEGOIvnShWRrtI3HN/THKUhV9geH3qtjeiXb/H2 CPgOu4omUekgLSSOirzjJhVwvOvfiNyOCGL2OiSQv3/JXiflZBILeNBlT7gXWla7JDdD 6SVIZJOO3DjutjfjYS/zBWjGhddlxydcpleHR4vf36sPa8RZp/MmFo9MLqsL63/NaQ4r rhX2rjzLq92bbd248x/77KAhtpTFMymPzycp1GP010ZBIRkklhasCjtjlrMh65ZsAnO+ eaOCgPDnUNerNa0niBnNvqP08m0uhH50XDSVIr0BowOj81UwA0eF97tJ0QAOPF5Ezi00 WBMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=kHky0QDiC2QysVXf/+a64btSB4ziIf21lTp0AdXY13Y=; b=NIpkVwecilqkflgARO9V2Rr80WldKu1ke27MeaeBdONPpUIe5yAf/Wc+wbsixACk2+ mSEvc+lu5+XSo/bQuvXK/0OQf2Dn2X3xZ+74m+HvgJwP+aHCKzkvuSEmZicx9wzWUi7H pQmw/MMopelNgVkKg0x6/dyYArc0O+WYtQNEJZhYX2PCMAozyvQfhCWBDYCRen7+Uej4 /4l9QBZ3AC1C+7UZpd6QjK+Xe8pU3JrPlDgQQP4JPPvGP7uFbda3VPaDh0jDgV81V2ld HA6ueZyTvNJf3bDhogINEhnmprs5C534avGY5Noi6BcqLqbrDm4gT0J9xd4wEFj8tuk0 ktpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PKw66Jot; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 124si36034010pgg.581.2019.07.31.18.43.18; Wed, 31 Jul 2019 18:43:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PKw66Jot; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729818AbfHABcY (ORCPT + 99 others); Wed, 31 Jul 2019 21:32:24 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:39614 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726594AbfHABcY (ORCPT ); Wed, 31 Jul 2019 21:32:24 -0400 Received: by mail-io1-f65.google.com with SMTP id f4so140714351ioh.6 for ; Wed, 31 Jul 2019 18:32:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=kHky0QDiC2QysVXf/+a64btSB4ziIf21lTp0AdXY13Y=; b=PKw66JotLcEiw3GkoG7WPblkrlX4gIOgfFvHKh3Intl2TpWalQgvOlxGuMz3GKPWpC +YLxmUcY0v1jFM5sqaYy4+Q5NSFvVmCDx0/o27fNeQUBn/FZfxQbIRD5H6K4dhmHh6Z/ lrAaB4ahqZ/9TZyZq4cnkBuxWw4U9TWDC3iZ6BajGAArx8zbRkLY/8bKfTa9sljvI2t+ YZdILOaxoGhcuhdPgG9dY/aA4PUOLDlbIJt6QEx213ShMcmze0JWH7n4g7QL06KZdC4r Yw4OUO0hBfU0V8L2O6pbUmM9RKE260YG2iFMrAwS7qO1KFebeyeMA20zKPbaY6NYIkvL R8BQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=kHky0QDiC2QysVXf/+a64btSB4ziIf21lTp0AdXY13Y=; b=NZ24O+1Z0qY66P3ZdrdOIkFrpJL5LVeBMUQPORRaWrC/MJTbHC5JbeR/FbqOhmjz1H 5L6XHVOIDCEaNXpC4Bp8f4jM3nopR3zwr7cExZZa6akYjFr36LZMlJf+kMnnGFFqvd4X bHbg9syi1xvvsobVDqqqIYck3rnTpNw+2h0euZGx+j0fzRu+lVDp7amWisw0VqHKrUAZ k9UantLJ0Gxc7S9tBaA3cRSyWjAf4T6T3XJx0WnPxNqq137CDoy6Jtz93TjlE2uMCHi1 piPjpbA/b4rHT7wVkRnGmPJ9kUs7GhqCi1gvDGuyeaYz1+bg5XVDo4t8NXlR2IiP3hB2 8ecg== X-Gm-Message-State: APjAAAVbo/IGcfubzc+OdPDgc2fqltVh69FbkS8peL6CkoM1wFaBZTva 87CxDWGhsS7b3glvdFAfFh0GoTGF X-Received: by 2002:a5d:8404:: with SMTP id i4mr45505439ion.146.1564623143369; Wed, 31 Jul 2019 18:32:23 -0700 (PDT) Received: from [192.168.0.8] (97-116-188-146.mpls.qwest.net. [97.116.188.146]) by smtp.googlemail.com with ESMTPSA id r5sm61273727iom.42.2019.07.31.18.32.22 (version=TLS1_3 cipher=AEAD-AES128-GCM-SHA256 bits=128/128); Wed, 31 Jul 2019 18:32:23 -0700 (PDT) Subject: Re: [PATCH RFC 2/2] futex: Implement mechanism to wait on any of several futexes From: Zebediah Figura To: Thomas Gleixner , Gabriel Krisman Bertazi Cc: mingo@redhat.com, peterz@infradead.org, dvhart@infradead.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Steven Noonan , "Pierre-Loup A . Griffais" References: <20190730220602.28781-1-krisman@collabora.com> <20190730220602.28781-2-krisman@collabora.com> <31ad0ada-ecc7-60b3-e204-898460254be3@gmail.com> Message-ID: Date: Wed, 31 Jul 2019 20:32:22 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <31ad0ada-ecc7-60b3-e204-898460254be3@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US-large Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/31/19 8:22 PM, Zebediah Figura wrote: > On 7/31/19 7:45 PM, Thomas Gleixner wrote: >> If I assume a maximum of 65 futexes which got mentioned in one of the >> replies then this will allocate 7280 bytes alone for the futex_q array with >> a stock debian config which has no debug options enabled which would bloat >> the struct. Adding the futex_wait_block array into the same allocation >> becomes larger than 8K which already exceeds thelimit of SLUB kmem >> caches and forces the whole thing into the page allocator directly. >> >> This sucks. >> >> Also I'm confused about the 64 maximum resulting in 65 futexes comment in >> one of the mails. >> >> Can you please explain what you are trying to do exatly on the user space >> side? > > The extra futex comes from the fact that there are a couple of, as it > were, out-of-band ways to wake up a thread on Windows. [Specifically, a > thread can enter an "alertable" wait in which case it will be woken up > by a request from another thread to execute an "asynchronous procedure > call".] It's easiest for us to just add another futex to the list in > that case. To be clear, the 64/65 distinction is an implementation detail that's pretty much outside the scope of this discussion. I should have just said 65 directly. Sorry about that. > > I'd also point out, for whatever it's worth, that while 64 is a hard > limit, real applications almost never go nearly that high. By far the > most common number of primitives to select on is one. > Performance-critical code never tends to wait on more than three. The > most I've ever seen is twelve. > > If you'd like to see the user-side source, most of the relevant code is > at [1], in particular the functions __fsync_wait_objects() [line 712] > and do_single_wait [line 655]. Please feel free to ask for further > clarification. > > [1] > https://github.com/ValveSoftware/wine/blob/proton_4.11/dlls/ntdll/fsync.c > > > >> >> Thanks, >> >> tglx >> >