Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp1152307lqb; Thu, 18 Apr 2024 01:22:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRlgYyUhqplXqYO1crZnn+Ei3bP3hkDjtBRb6KGuudF8gnpLVzLurhuICIKuzNX2Ijfr3zrF5K/r6Iu5ND7W8S8a6Ua+ZEqfGvEH6Gjw== X-Google-Smtp-Source: AGHT+IFz9KWEjriYj5uOlLL3Mwu4j91ZmOnUz3H1JM0RzNIvEmDOXDUq/F2JykJfbjgE4GrgRu+g X-Received: by 2002:a05:690c:610a:b0:618:7c12:cdc with SMTP id hi10-20020a05690c610a00b006187c120cdcmr2077609ywb.17.1713428529470; Thu, 18 Apr 2024 01:22:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713428529; cv=pass; d=google.com; s=arc-20160816; b=c41ilubMaRUpmTZaKHh92On+yJ5ARg3xPzajSNc5li9Sr7mFZHqTlqDtq+HSq8rKdr /r2K+GA2ZYBd7rd6jzdU9TXELTVqI594XMkRhqWgypeujkrSWtcU4JI765lnlHZNbY1h CJ3L8hQan644nYWCmJEspOhJDqgLgIDpT3QXtDzZGltlTgod1ubghygG2PG9ll3PvdvG wvY7/W1PoQd4WQZUIiZkKoIeLGIqV8LoYemmTKrjPR7PH4NUs17L/aaKtgSj4/YdG5mV SXig2u0ywnaICDqNRt5/LmWtJdg544GbLCnV6zA62H1tIKg7VXpl7I8U09kZXK3kqDBN jLxA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=K+8bkpMeAf9u6G5CwH+yaUjM/yOhNANN61v8jzel8hY=; fh=7frAeR+Y2RGoHYyYg5U7BNHXErDRKGMtN9r8FLIgbBc=; b=hVqB1FUzQ3YqQdkQYDq0+fA63OGW7ZIcBfX7wZM+XGvlRxyCIs52dQeRJm8GRqPxrK X2bFcTTqyqG79ZUUZ398vyafXp4KEOw4e6kiIGq/MUCTYXHg9/JsbNwou7hD5BrTtv/Y ENyjQ6gmOQIL/hly1bD5jtl4o7g6LM8BaQU4AwyDSYw5co1bTWnkes2B7+cL/D/+aOyD 6apLNUvwMQ+FCl6HWl1NGCmSGACGTQWmDMtkOz+eXZlxH7I65V5nAV+d6Eh5PlmuFy2Z f+5qzOQJeKYvXfy70nYoCFKEAweL7LpCW3SWuCH9elr1pIAbAH7dLGGuPCWDXPLi89R7 Z/lw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=C2RmqyBv; 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-149706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149706-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bb39-20020a05622a1b2700b004363f54f392si957572qtb.731.2024.04.18.01.22.09 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Apr 2024 01:22:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-149706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=C2RmqyBv; 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-149706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-149706-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 11B211C20E0C for ; Thu, 18 Apr 2024 08:22:09 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 74C8C85627; Thu, 18 Apr 2024 08:22:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="C2RmqyBv" Received: from mail-ua1-f51.google.com (mail-ua1-f51.google.com [209.85.222.51]) (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 467E15FEED for ; Thu, 18 Apr 2024 08:22:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713428523; cv=none; b=ICusRkvUZq8dCk7i20mMQHgZGgNC5LIPQcwu7w/yr3ru0492uMkriPxZ5bHrIRkXndX+WNvOoDlmL4uM7GIJZUId1GXnoH7xwuFTfCKspHPl3FoqVO/OiPhaf1FzTaGZbUiSvEhSK0NKZcSwcJ8gsGfh4A3yZEq9Fn82Hy9gOgM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713428523; c=relaxed/simple; bh=0ZDj0G/BGIyYtXLBhUWNKzrpPYx4AB0yhF4/Ou7P5iQ=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=X2BoR9O0/4nwbdN9m5925ZAyyGqCEvkiq9VLW+mlA1fHBGmQQE12Yzn2Jjm6M8jbXCncAlJuCWV+Tc/ZbgHyezQKeJC2juq/YIYrdZBL17p5A+TXSvOGL3REV957aY/jL6D8HJijbHuKkuVoE6dOYGnf1yUj80tFtKttNWzq/Cg= 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=C2RmqyBv; arc=none smtp.client-ip=209.85.222.51 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-ua1-f51.google.com with SMTP id a1e0cc1a2514c-7e978e12390so176184241.3 for ; Thu, 18 Apr 2024 01:22:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1713428521; x=1714033321; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=K+8bkpMeAf9u6G5CwH+yaUjM/yOhNANN61v8jzel8hY=; b=C2RmqyBvS152diBHytk9gbTz8/EKx7MaL5kJ6nTgOuK9spFSaKJj/8Hwz/UZtJ+Qp9 EAl+sWKAM43Mqm4ZEEAOfAwqLW+FbjkE0SK1T3biqqEh2chJJf+wEx9wVDpQSxse3s48 +MRT2nO4Xov3W2hpzRVIycUbfXrzpPIpSleksYLzdvxV9w+TNHPuYfedJiqy66e8qNwM aKlwAJwyG7PMNJDjNDYZEC21Gmb017OriCzUimLQgWQkZbaxuwZnfndmEtDjDPq2HgYK usGrzBbF3DICgYcPiDtTgp6IwBP1E4QBcpU2qiMmEHvq9mKTsKT3LKERxJIvAShsKeN1 Ds5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713428521; x=1714033321; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K+8bkpMeAf9u6G5CwH+yaUjM/yOhNANN61v8jzel8hY=; b=DtFX84DfD/JqHlGbUz04afGXTexf84tw7mkDsUdgQ9+GYnnRNLTKIL+CZLwdC5o1ob kuy1cXApXFkEQ8JI8C3ACOa52lrZSK16er/Rf/JZniW8TdFFbF6eIUKpBKp9APaEAI/l dnaio//IvoEewKK2Yc9RZezw38E0bMK0jPaC5YyRZB/MHNplXoKS7TquiCMPivYh1ezG tQRZfvyuzjrwfXG4WSsoLM0OseAMdElhvRdnxmxhh7VAQB9EpvMNVpZH3/IgkA228yfj AiWVjQgMhQ7ojbdksciRVPhuVvll/3oG4v5mg4btCqan0Cy2ZhaU3PlnhXHLGS5AdLte Q+Ag== X-Forwarded-Encrypted: i=1; AJvYcCWspGQMCjIwhIFGBo4B6XKFvW5HwUm1CJpgIZ1x14OfBs2xAnH+a1LW9IOfF7yIsW+s5pqBka6IYmdVWXJLoxCV1BMEXM1ChCC3nCoF X-Gm-Message-State: AOJu0YxZ5HxEpvr3MaOgppo7H0T4P2fzRLHdwaSBfnPXwjN5SFl3qxmX 1CYnGCpBE6t4r1exYsXMp7WokHrPZUQvC+lfwKsEeUs91ORrU4Tb6brL1w5+epBrgYP6bgd9B2O YebeGQbbrqt6WeC1wLcT7yn9Z1mjHao8HekmS X-Received: by 2002:a05:6122:208f:b0:4da:9aa1:dd5e with SMTP id i15-20020a056122208f00b004da9aa1dd5emr2606088vkd.10.1713428520877; Thu, 18 Apr 2024 01:22:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240417191418.1341988-1-cmllamas@google.com> <20240417191418.1341988-4-cmllamas@google.com> In-Reply-To: <20240417191418.1341988-4-cmllamas@google.com> From: Alice Ryhl Date: Thu, 18 Apr 2024 10:21:49 +0200 Message-ID: Subject: Re: [PATCH 3/4] binder: add support for PF_LARGE_HANDLES To: Carlos Llamas Cc: Greg Kroah-Hartman , =?UTF-8?B?QXJ2ZSBIasO4bm5ldsOlZw==?= , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Suren Baghdasaryan , linux-kernel@vger.kernel.org, kernel-team@android.com, Tim Murray Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Apr 17, 2024 at 9:15=E2=80=AFPM Carlos Llamas = wrote: > > Introduce the PF_LARGE_HANDLES flag to enable the use of monotonically > increasing counters to generate handles. This improves performance in > transactions when dealing with a large number of references. > > The legacy logic performs an inorder traversal of an rbtree to find the > smallest unused handle. This limitation is due to userspace using the > handles as indexes (e.g. in vectors). The new logic scales much better > but requires userspace to support large handle numbers. > > The benchmark below with 100,000 references shows the performance gains > in binder_get_ref_for_node_olocked() calls with PF_LARGE_HANDLES. > > [ 167.855945] binder_get_ref_for_node_olocked: 17us (flag on) > [ 237.088072] binder_get_ref_for_node_olocked: 18178us (flag off) > > Suggested-by: Tim Murray > Suggested-by: Alice Ryhl > Signed-off-by: Carlos Llamas Reviewed-by: Alice Ryhl