Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5576370pxb; Tue, 16 Feb 2021 01:58:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJySKghAXuwZPjPYf6rf/h90engUgCYqnXzR/IA7sD8Wkt11PukMQY//dzn85m0TbiivQ2SI X-Received: by 2002:a17:906:398c:: with SMTP id h12mr20034667eje.469.1613469532608; Tue, 16 Feb 2021 01:58:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613469532; cv=none; d=google.com; s=arc-20160816; b=Jf9t0BhuxR30XQQn+8YOPt914OOjirSXHCDKFrMFc9Ds3WGaFYQQ7tR9r685FX0X8b BbP/nzwmOqF6se3kgK8IGlGAxgJZjq+eSjN/ZPoF+V5aRluuW2eDRGIMI7LAm+i/1qna P0UXNSkqoNz+7m/DqreX9hNkWmT1ioBYvdkHnMPP8ujtFZbGsCQ8G1JUwqtOm0vW1aXA kI9k7I+CsZhNvcbcOS0IoRebsmWtDjfIavcUvHri8fD3HVhfIAqKd1TwjAmpRLIVKdjh HXilIfl9Hr7v/32KgGhjsTtV/iJ6XmBASXGoABPO402/cmSHvEutbAP1FQizAEjsKU54 i8hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=G1rJISCtbmEjkZgEkUza1CHcQJlALOsUgrEKGt62Ww0=; b=lCwTfGWq06wCLS3DO6uoM8wNkuN4WLEnrZr4MyT7qXt03mk1g2dPCh0hhB7DVWeobm NdGz6yq996cE7tpp5RLPcMAxTEA3JuoPReqUosmNs6eOW1PZA7Cr2ZpqRRLrxXorPIGs EJLicnzqdzSPoXAHKqlgQup+BSGpOhnLzYqaFA/2zdJZ8JQxMMClOYgWzw6Un/jh2x4s av+lVGWRvVSx6eb15G5JvSE0al31Qs//luk/gqDzsIluab8k1BwIb92o6b+bbHVlLU2D /8IjDlsiM8Sd7MoTCvaIXR72dD9ZkSwtd03gkJ3bLntFfkY7MsJvUkJQpAdnK2+dQgWb I8eQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=ITqmpNKL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id eb8si16877842edb.535.2021.02.16.01.58.29; Tue, 16 Feb 2021 01:58:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=ITqmpNKL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbhBPJ5U (ORCPT + 99 others); Tue, 16 Feb 2021 04:57:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229917AbhBPJ5S (ORCPT ); Tue, 16 Feb 2021 04:57:18 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2735AC061574; Tue, 16 Feb 2021 01:56:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=G1rJISCtbmEjkZgEkUza1CHcQJlALOsUgrEKGt62Ww0=; b=ITqmpNKLZ91FyiouFCGBCTWmOs 7sMWLgI50fSxJr25JP3GJS2U8az6ucJFSiedQ4Qo2+o230RH8NNwnYpL6n5xVjOADJWU5zSn62jEJ ZduLmaFu/nJkd3yDWNiZjdoX3hDhrHWJTp9UpapAPbS4uttrIxjBdt1iyMSsPzJ/DRKqO1ya1tewI JGElFy/xxGQZFzImfhm41Wp+NVWGBImdFFDnT7mJxme55PgDu4rWIz6/nZy1ADzI3Zy1WLyTDi8/c uYnk5VR4fMgLcQ81zEb61F/uBgKYvytslkoZQpuqUFKBxUXO9c3Tfzyu6tEzAN0HXAuvkCouDrIgG cBP2ZXtg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1lBx5d-0004uh-0t; Tue, 16 Feb 2021 09:56:17 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id BC20D3007CD; Tue, 16 Feb 2021 10:56:14 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id ABB6E2B82AB42; Tue, 16 Feb 2021 10:56:14 +0100 (CET) Date: Tue, 16 Feb 2021 10:56:14 +0100 From: Peter Zijlstra To: =?iso-8859-1?Q?Andr=E9?= Almeida Cc: Thomas Gleixner , Ingo Molnar , Darren Hart , linux-kernel@vger.kernel.org, Steven Rostedt , Sebastian Andrzej Siewior , kernel@collabora.com, krisman@collabora.com, pgriffais@valvesoftware.com, z.figura12@gmail.com, joel@joelfernandes.org, malteskarupke@fastmail.fm, linux-api@vger.kernel.org, fweimer@redhat.com, libc-alpha@sourceware.org, linux-kselftest@vger.kernel.org, shuah@kernel.org, acme@kernel.org, corbet@lwn.net Subject: Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions Message-ID: References: <20210215152404.250281-1-andrealmeid@collabora.com> <20210215152404.250281-2-andrealmeid@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210215152404.250281-2-andrealmeid@collabora.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 15, 2021 at 12:23:52PM -0300, Andr? Almeida wrote: > Create a new set of futex syscalls known as futex2. This new interface > is aimed to implement a more maintainable code, while removing obsolete > features and expanding it with new functionalities. > > Implements wait and wake semantics for futexes, along with the base > infrastructure for future operations. > + futex_table = alloc_large_system_hash("futex2", sizeof(struct futex_bucket), > + futex2_hashsize, 0, > + futex2_hashsize < 256 ? HASH_SMALL : 0, > + &futex_shift, NULL, > + futex2_hashsize, futex2_hashsize); So why are we implementing a whole second infrastrure and doubling the memory footprint of all this? Sure, futex.c is a pain in the ass, but most of that is not because of the interface, most of it is having to deal with sharing state with userspace and that being fundamentally unreliable. Once you want to add {,UN}LOCK{,_PI} and robust futex support, you're back to it being a giant rats nest of corner cases. Thinking a new interface can solve any of that is naive. So while I'm in favour of adding a new interface, I'm not sure I see benefit of reimplementing the basics, sure it seems simpler now, but that's because you've not implemented all the 'fun' stuff.