Received: by 2002:a05:7412:8521:b0:e2:908c:2ebd with SMTP id t33csp1365rdf; Thu, 2 Nov 2023 12:01:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH22X9+7ZdyumUmcmK+CaMzQqIhfzfen/7cy3JNS7wiMLCOT2ElbeauPY/koUsJ8IEJp2N7 X-Received: by 2002:a05:6a21:3290:b0:17b:129b:196f with SMTP id yt16-20020a056a21329000b0017b129b196fmr23899090pzb.11.1698951696606; Thu, 02 Nov 2023 12:01:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698951696; cv=none; d=google.com; s=arc-20160816; b=vjD8iNN+cHf+uxdqMsdrnja26d7Swi7hkPS2Fwg53zaRf3Jjx8grUTbV52NhvGKwRp uMM1WdjZJX3FlABXuotY9sKnglXQESiLqXe3c+lHyU5shif9BT2rOcgWfbAPh87F82ZH OusxVgoxhBA9Tth5VUcBhyx6Gy2iAw/SwW14abiQOmXATyk3i90DM+2YjPokW6qFnrn2 EwaFKheLQxDE6lt7RVNnm3Y2MREfxmjhuqBovbhhIdgQOFe4lfdFq0DM4s/GQ2bWv6DG dE85E09H47+UGM/y9s3LiWXKtRONaBOcjGFuHoVuJqPbgGcS1A7XISCrmgaB8MISWCYT Wygw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:mime-version:date :dkim-signature; bh=WCKUp+kYTjUgU6Mz2cf8nQWD88JU2ZTKm40auAGmVFI=; fh=yRjXrNsqrCDLi/whgZlovsTeZ1FRcLzLSwakrFJMwBo=; b=rAXbm8c8cNdvnHzkISD9YCBTawtv8SOuzYCqvjv9LGGDu/2LM7YZw6N/ed0vFavjq6 9Xt9oFvaW+tQ8A7nuLaU1LHnpcr4RNrdmS323rZe0acbpZHW0DVuDQocipIq+YYt5H1e i+akg1IGNbuu3TidTk9D4xhaKPlFxunP4XO9CjdmwfLR7nbT3nJvPvzh8duz0XHgXaMs oiB1frOSUEUxo/2+0+o2VorvEKiZL+znCklcC0n9z1gA9edmwrTRq4YRYYWW8m2esbte MpN9YY06ftTbrZ7X6FYksQyDPAHFxt8DPkdSzPsIcRpdA/zbbPQ4MCTzAmXjawMCVGn6 pknQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="c/adk68F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id by19-20020a056a02059300b005b874265d1fsi119816pgb.513.2023.11.02.12.01.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Nov 2023 12:01:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b="c/adk68F"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8FBA980216A5; Thu, 2 Nov 2023 12:00:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347225AbjKBTAf (ORCPT + 99 others); Thu, 2 Nov 2023 15:00:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229686AbjKBTAe (ORCPT ); Thu, 2 Nov 2023 15:00:34 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D46D182 for ; Thu, 2 Nov 2023 12:00:30 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id 3f1490d57ef6-d9a5a3f2d4fso1511123276.3 for ; Thu, 02 Nov 2023 12:00:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1698951629; x=1699556429; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=WCKUp+kYTjUgU6Mz2cf8nQWD88JU2ZTKm40auAGmVFI=; b=c/adk68F0D5Pn+goJVSDIB3oevgiTHGWXx/6hKylCvWy7CugmvlHDdES6AyRu4McMj xY+BmZyF7iFlB4H1O1ylWmlx68cRCeEQvlO7G5TcXMbqJ0f72VQeJBjWdJeRnex95RXy IYVK9SJT3m1A3Ci90GWbOkCmzdD4IDEd9VtBCkdlDHbUnA2ATA4/RrxjH8T5p8iZXiVf Qkiv+0Fn9gL7NvaJsiM9LosOrVDMWq7JDehqOHR0bN1DCbRSKeF+NPL1/cV8xIeJnNLH PTmClWA9zKn9xZOYv8YWZ0m581eaaidAlBhF+b10zJY/aJTNRWMtsjUDNteYn7i8e+0V 4Bqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698951629; x=1699556429; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=WCKUp+kYTjUgU6Mz2cf8nQWD88JU2ZTKm40auAGmVFI=; b=RUoM7/mKPeEJfCIb6hUjxeiwZ/n6kpq/dIcwlY7jXe+OD2TRfREYNE4sHGYNOGzYe/ VfBgL36Vsxw07OKt3CWBAKB58jJxeotcklsHHA6IIZSgKSTppteh/GvY3RPCtNCSZyUP RHI4Yo/o7hmWCUr6Mn2s6b4pjINhhriDQja7e+G3aGT3D8iROpy4mQ2TkLED5IGleqOs FxhGAm+6Mj+mXhsZGz+067WdRBMdFcWDrArJML9vET7Do8Snl7qraVBbuvq/8/nGUKP1 CargHBm2GU397c68q+Q32fGe/oTb1YJZRzUTr1iLgvX6qIhVwVzosa2U1j1ip8Nl9w/0 bCqw== X-Gm-Message-State: AOJu0Yy6TIZrBqTBxj7u5KnKMdiDTzsQZ2eZKRss2dsIHT7i56bM4ZUL EJN8IWjbEqKnOQ8UoyycpsS5yWkYPgQFdg== X-Received: from xllamas.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5070]) (user=cmllamas job=sendgmr) by 2002:a05:6902:1083:b0:d9a:c3b8:4274 with SMTP id v3-20020a056902108300b00d9ac3b84274mr463457ybu.7.1698951629488; Thu, 02 Nov 2023 12:00:29 -0700 (PDT) Date: Thu, 2 Nov 2023 18:59:01 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.42.0.869.gea05f2083d-goog Message-ID: <20231102185934.773885-1-cmllamas@google.com> Subject: [PATCH 00/21] binder: convert alloc->mutex to spinlock From: Carlos Llamas To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, Carlos Llamas , Todd Kjos , Alice Ryhl , John Stultz , Suren Baghdasaryan , Tim Murray Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 02 Nov 2023 12:00:53 -0700 (PDT) This series refactors the binder buffer allocation space to be able to convert the alloc->mutex into a spinlock. Doing so decreases the latency of binder transactions seen under worst-case scenarios. I attempted to organize and improve readability of things that were touched during this process. I also include a couple of fixes (unrelated to the lock convertion) for issues I found along the way. Regards, Carlos Llamas Cc: Todd Kjos Cc: Alice Ryhl Cc: John Stultz Cc: Suren Baghdasaryan Cc: Tim Murray Cc: Greg Kroah-Hartman Carlos Llamas (21): binder: use EPOLLERR from eventpoll.h binder: fix use-after-free in shinker's callback binder: fix race between mmput() and do_exit() binder: fix async space check for 0-sized buffers binder: fix trivial typo of binder_free_buf_locked() binder: fix comment on binder_alloc_new_buf() return value binder: remove extern from function prototypes binder: keep vma addresses type as unsigned long binder: split up binder_update_page_range() binder: do unlocked work in binder_alloc_new_buf() binder: remove pid param in binder_alloc_new_buf() binder: separate the no-space debugging logic binder: relocate low space calculation binder: do not add pages to LRU in release path binder: relocate binder_alloc_clear_buf() binder: refactor page range allocation binder: malloc new_buffer outside of locks binder: initialize lru pages in mmap callback binder: perform page allocation outside of locks binder: reverse locking order in shrinker callback binder: switch alloc->mutex to spinlock_t drivers/android/binder.c | 25 +- drivers/android/binder_alloc.c | 746 ++++++++++++------------ drivers/android/binder_alloc.h | 57 +- drivers/android/binder_alloc_selftest.c | 8 +- drivers/android/binder_trace.h | 2 +- 5 files changed, 428 insertions(+), 410 deletions(-) base-commit: 21e80f3841c01aeaf32d7aee7bbc87b3db1aa0c6 -- 2.42.0.869.gea05f2083d-goog