Received: by 2002:ab2:7a09:0:b0:1f8:46dc:890e with SMTP id k9csp139422lqo; Wed, 15 May 2024 09:43:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+62gTXI5uNeP6v2kxO2yWsTW5hSQU2O1Q837L2HvpxABqwR1e/wYiLm7cjcfw/dM6VbjhRcZzkHqygN+LoOP9dHRwltXMgbiu6N0UfA== X-Google-Smtp-Source: AGHT+IH02jt4rsc/nzrBK9fTEVF1f0ITp38KA5u58lSFU8tCE+t9GBqWrLTV+f5MyWBFKLVwvQri X-Received: by 2002:a05:6a00:2409:b0:6f3:f05c:d2d7 with SMTP id d2e1a72fcca58-6f4e0298b86mr18861986b3a.2.1715791425683; Wed, 15 May 2024 09:43:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715791425; cv=pass; d=google.com; s=arc-20160816; b=GpR58/pCl8Q99I6PeZKXGoHE1J1GU/W1p3Eg/X8z2/425n2SXYIEWVd+r3/lanG7MB 2gUAAyJdvF97XODAzKCQgj5TbmSq9JT8Gw3QO8qulhcHzhKVr5sXlfsoIKUc4A6NBlgQ gSqRgeIzo+GECYrTTbCGWUssyGgLa+xjm+3ydhpwXu4oYHstTSiFKoeskDvA2Su0HhIE lTb2Hn5l5N6jBfkIioMaUzEjxXKwVMH130rM2rU1oQakmLVG5zMw+B0TvpYOvDfue3Ld Wi35NPV9iP4u5Dmewezz86fFAWgfms1HmU24G/w9wWI92kk/qSBI7CFbjcspLvwIikU+ iUww== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=KCJMwu966FDCcIlfPMsfyySrZYW0OH3ewcgATtZeRrI=; fh=hL72QLzNeNrz9q7DDalKpE9SRqJ6eARTbhOjIOODAo0=; b=CgcXLSV+NmkXO41zWuw1PefM0SlZMrCQNv1iFCc3OORx9m9yf+WrZ+/WPCeJEqyx1o tw6vRK0zi+B8PIIE6834ncY1FpqfCz9ODCwHvD96S7mTaWWCpYtm/O33GcdZhP1c7Knw cucKfnCVcVF9ExeB5fRnfqkmYW1IH4drMw0Q8+iisKWWrDg9FVMwIzHapPB2BfLAQvK2 U3aAqA2K+/aYRkFN5WN+2zRcRJ41ti92hUyOVDqUh74Ux92iWD0WHgeQkNTaS1mhd53k 8JUrg1uYT9OnxrmSuqyVvwndeuQzeTispdnqJ3VGLlnizytoPg/1BYx5CTpQQ7znmmK6 opRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mjCct2JV; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-180158-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-64ede0bd479si3609701a12.579.2024.05.15.09.43.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 09:43:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-180158-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=mjCct2JV; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-180158-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-180158-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4DA59284AFB for ; Wed, 15 May 2024 16:43:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3359823776; Wed, 15 May 2024 16:43:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="mjCct2JV" Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1D33CBA46 for ; Wed, 15 May 2024 16:43:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715791420; cv=none; b=MpocuEeJG885M7WbYQ4jLmNLc9LnDvW9aAckGRkiI6z2tZiiaB3su+3rObkxO49HkdkpbxTJl5maXjm/QwYslASD9HKxtAFqXgqrUJxfQ0/bb1W2vNWAMMwec2dg3m4tT1+LuCG8pqUU2C0uhlZLBjkFKUlKc0V2Ut+DhpPWhqc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715791420; c=relaxed/simple; bh=jcMjC0VbA65cImgzcjHwNorDdRf5gwj1tQfrzlHFPJo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Vd4tJcZN9Ijjb1RnXeKxl8HBhcHEMetNvSIMe0UYZdjQbBZl1WMysFaHaCjJ6SQTerwtVEq31e2biaaCwv4QkjAb1X8/sPS+bWdedZ65D8yoL40e4XVHeuGHPX1Rfv22GwCnR3niLW7etJzWmZPxSaJkbZ9ZioCkJw59xymsQdo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=mjCct2JV; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-6f4521ad6c0so5811209b3a.0 for ; Wed, 15 May 2024 09:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715791418; x=1716396218; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=KCJMwu966FDCcIlfPMsfyySrZYW0OH3ewcgATtZeRrI=; b=mjCct2JVnrB3tOkSFRtmV4vnaDC2QDpOfTsuYxF1YuhXHtgqYtI2qUGMuKKtOXYH6x W7xD64An7Yar1S3QNSOWUC0nONNE4UxflRx+QJ1dKxzeQWcsoaP905z/ncSoJT6Qy40g u/3L3n5xhcWPzq6Zi1QrUQgS+K9Gt+mRBAwxQR+wzGgcq6h+rxldagTirWQWOAPFUdn2 FraWpWHVeQTgIt86fRZpBPVB4Gy8mz5bi//wCmp+VOp5aVBxlzIXEb9fw8otuHZCB0op GR/dxJ2cX6+n4W4j2odv0/lbO0fleWvw4VqVyGoaAEzNXTKsNhzg+70HZt70qrQJdiI8 1oYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715791418; x=1716396218; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KCJMwu966FDCcIlfPMsfyySrZYW0OH3ewcgATtZeRrI=; b=dyT3yA67zJVf3CkUw3+y36VbQZ1vF5Fxrh5PrgLUCYDgLXtqH+oNR/HcUhjVjjb3h3 1PuZ7+NPoGDQpbJqxzuWZ4oHF+mrw7ZRWxvsf2OrA2vlyXt6tAvSci4SoqGnsuVo/J66 q1LeFxhW7lwqk44NkGWBwgU9soiYgVn0Q2etcFW7c2Ucu2OPhG6APD+mGvMeIqLfVMAs XDFrxGaxtVRh/9gqTVRMy1naH9m7k389VYu7Pd8SdoC+WwxRPD7XhlgRaL3Or5tr/pHX 2Wvz/jPU4vf3KYbnQeNnhHJOaqHA/SXYMKeWAL9q15uE2737IO5t0aZxQNEzK2KXfRbm +X2A== X-Forwarded-Encrypted: i=1; AJvYcCUBGb42CcIep6dVl51sZ5drYgb0pSo7VzAiVmEczcI6RtTfrMNeNYljPb/w4E82eQ1SKkDthNQa3KNtEad0pAeFcZot7d6JICxFOncU X-Gm-Message-State: AOJu0YzZUZQd2DnjW0Rfikv0AqGASibwv0mZcpA0UFK7h040i8W5fawp wrrHdVXEkxb4+qnsfom4S0zCssjJErBlPYSUjmUtlGJA9Bzy+g2ar8B3kGYbTA== X-Received: by 2002:a05:6a00:21c1:b0:6eb:3d37:ce7a with SMTP id d2e1a72fcca58-6f4e0347c31mr17055835b3a.21.1715791418123; Wed, 15 May 2024 09:43:38 -0700 (PDT) Received: from google.com (57.92.83.34.bc.googleusercontent.com. [34.83.92.57]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2b300d9sm11292594b3a.215.2024.05.15.09.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 May 2024 09:43:36 -0700 (PDT) Date: Wed, 15 May 2024 16:43:32 +0000 From: Carlos Llamas To: Alice Ryhl Cc: Greg Kroah-Hartman , Arve =?iso-8859-1?B?SGr4bm5lduVn?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Suren Baghdasaryan , linux-kernel@vger.kernel.org, kernel-team@android.com, Tim Murray , John Stultz , Steven Moreland , Nick Chen Subject: Re: [PATCH v2] binder: use bitmap for faster descriptor lookup Message-ID: References: <20240514160926.1309778-1-cmllamas@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Wed, May 15, 2024 at 04:38:51PM +0000, Carlos Llamas wrote: > On Wed, May 15, 2024 at 05:29:29PM +0200, Alice Ryhl wrote: > > On Tue, May 14, 2024 at 6:09 PM Carlos Llamas wrote: > > > +static inline int > > > +dbitmap_get_first_zero_bit(struct dbitmap *dmap, unsigned long *bit) > > > +{ > > > + unsigned long n; > > > + > > > + n = find_first_zero_bit(dmap->map, dmap->nbits); > > > + if (unlikely(n == dmap->nbits)) > > > + return -ENOSPC; > > > + > > > + *bit = n; > > > + set_bit(n, dmap->map); > > > + > > > + return 0; > > > +} > > > > Could we rename this method to something that makes it more clear that > > it's not just a getter, but that it actually also sets the bit? > > > > Alice > > Sure, what were you thinking? I had picked "get" and not just "find" to > indicate this behavior. However, I'll take any better ideas. The option > of dbitmap_find_and_set_first_zero_bit() seemed too long for me. > > -- > Carlos Llamas I like dbitmap_acquire_first_zero_bit(). Sounds better?