Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp4518747rwb; Tue, 6 Sep 2022 08:35:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR451/eOcIrQ+CKBgP2BfiFDrM52+AWTpkbnYaHjOzsk1HGx3HMKWVYgtDx4UM8Xy07iwZu2 X-Received: by 2002:a05:6a00:e8a:b0:535:cc5c:3d87 with SMTP id bo10-20020a056a000e8a00b00535cc5c3d87mr56008516pfb.24.1662478551298; Tue, 06 Sep 2022 08:35:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662478551; cv=none; d=google.com; s=arc-20160816; b=TSW591BOEFVIT3WkhNxed7atRoElxU5acR4PV+QWGuGhZ0mLQk1gcozLOxD9yqU1HC fAJFkXLv61SHyi75PfA8G96pgiJYySM//1cP7uwnu+h2Z1GOkqTtTZ4+GM/UqjEDSfFB Yw0fdldpufH/plxi8ba+u11h4CZubiNZK53N/Wjok/+R7EABUXUHxwgY2EauJStkSnZb bRWELqcfbw5xxPRy+I1Q8i2ll/wcxZTpGfhMT807WFlKeqgkcS1hbh2VQOSXPBUYA4h3 sYamM1oTpPuAl4akfp2Ip11n4ShGPbTFOaT7x+H2br65/2hY+qEjrKbB6wDHE6wrSyKx xm+Q== 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:references :mime-version:in-reply-to:date:dkim-signature; bh=S43B5VbJjHS0PJ6EeGXWAwhqAvbS5qlJaZ4GjrbF1RI=; b=gtl4n23A5u2ik1ih0sdawm69AQ6Z6fci6lVA1vEfU5qLOl8R4I5rE+qaawPlftOhqH 6ORvFQx+GTvL3W/KSsqUomitOKg+vVquwYC9auXzV6nBNeg90UDflIvkJg7qMRfV3hek QE+nDiWTtREeSX/lWFCiIFzW1HwEWvCi4V8QKEdUGVaKipHYHaTc9SGzC9cF+RNDndCc AKBfp6xoYO7vB+3Vq5i0aK/QOueKSlgCrREF/9VyKs64AT0v7TUJ88dfhh/+nX5+mZaa 9C1IJonXtbEhnDGX9kYuQv/RxZte9I++NZ5EfRHpJOmypFJ29t3HMzfhAMUfCcYqUWV5 uGtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Mh+eOLxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j13-20020a636e0d000000b0042bba5a062csi14352857pgc.280.2022.09.06.08.35.37; Tue, 06 Sep 2022 08:35:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Mh+eOLxH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238701AbiIFOlx (ORCPT + 99 others); Tue, 6 Sep 2022 10:41:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234075AbiIFOjX (ORCPT ); Tue, 6 Sep 2022 10:39:23 -0400 Received: from mail-pg1-x549.google.com (mail-pg1-x549.google.com [IPv6:2607:f8b0:4864:20::549]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE7B29AF86 for ; Tue, 6 Sep 2022 07:01:13 -0700 (PDT) Received: by mail-pg1-x549.google.com with SMTP id 135-20020a63018d000000b00430673f7922so5777828pgb.6 for ; Tue, 06 Sep 2022 07:01:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date; bh=S43B5VbJjHS0PJ6EeGXWAwhqAvbS5qlJaZ4GjrbF1RI=; b=Mh+eOLxHEbPlHpqMHmSaSX+6tf08G5GDTFan3UWIXZI26qQBFhyZgTFmobOIIGfoqC Brwe+9slcD3mlkOADE4mKXhhWLv/sAUIxzWY4dCEBmvOuekgpiashVSXYjdZyJoh0LGO F5slXer4q+y4RuHr4wwIJOIMb3n7+S125xBNkKZIaVgsSd3ozDtFol0COxXrjLdXd0Dm wq4GvFPK6O4mHYxv8vkSBggFyL2K9XQtJxbK0sTVm5NbUkkjUfGIwRRtG2OEa0ZNrpJy zb/bsruHsaWfa8qHHjs7lObbF68svhTIJjlrfDH5+Mi86JJYY/ch0ji5CDDbHqF9GGm3 udeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date; bh=S43B5VbJjHS0PJ6EeGXWAwhqAvbS5qlJaZ4GjrbF1RI=; b=BjcaRnrpDjDCjz0iz576IMjCLO8k1pQ5gj5D/j/H2CXBix0t/2ObTS5oWqCR4hBp36 T/irWi0FFt4od8BwyO6lXL5dnyonIXS+DVrwLPdJ5wGxIuszCir6L9z7xJphyc0r0Jti zDjUySGweIl0vm4c2z/dZKaj+FHW51PQead9TA1fD1ex/zCh8oFpGPpx7FKMlJWkXu4i xdgDIg0ok3RwK2lajrbp5Myh/cVtqk4pXzmrKY5Qe+zdQScWZNO1ugcq4L51OAZAvB6c ALuqClj3HkBY0/efsFj/wikXRroRTBRMvgIsFlH3/IMTwURDZxv6uuzTE8NOemjpY+v9 e8Sw== X-Gm-Message-State: ACgBeo3iMCpckp/ctGJOKs9i1TUeaX4nX+lwijhphvR777DjqHy/WBnl 2D9JqkAYs7+mlt9J613D5x4umeCuju/5pw== X-Received: from xllamas.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5070]) (user=cmllamas job=sendgmr) by 2002:a17:90b:10a:b0:200:2849:235f with SMTP id p10-20020a17090b010a00b002002849235fmr1125261pjz.1.1662472801461; Tue, 06 Sep 2022 07:00:01 -0700 (PDT) Date: Tue, 6 Sep 2022 13:59:46 +0000 In-Reply-To: <20220906135948.3048225-1-cmllamas@google.com> Mime-Version: 1.0 References: <20220906135948.3048225-1-cmllamas@google.com> X-Mailer: git-send-email 2.37.2.789.g6183377224-goog Message-ID: <20220906135948.3048225-3-cmllamas@google.com> Subject: [PATCH RESEND 2/3] binder: remove binder_alloc_set_vma() From: Carlos Llamas To: Greg Kroah-Hartman , "=?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?=" , Todd Kjos , Martijn Coenen , Joel Fernandes , Christian Brauner , Carlos Llamas , Suren Baghdasaryan Cc: kernel-team@android.com, "Liam R . Howlett" , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The mmap_locked asserts here are not needed since this is only called back from the mmap stack in ->mmap() and ->close() which always acquire the lock first. Remove these asserts along with binder_alloc_set_vma() altogether since it's trivial enough to be consumed by callers. Cc: Liam R. Howlett Signed-off-by: Carlos Llamas --- drivers/android/binder_alloc.c | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/drivers/android/binder_alloc.c b/drivers/android/binder_alloc.c index 749a4cd30a83..1c39cfce32fa 100644 --- a/drivers/android/binder_alloc.c +++ b/drivers/android/binder_alloc.c @@ -309,27 +309,6 @@ static int binder_update_page_range(struct binder_alloc *alloc, int allocate, return vma ? -ENOMEM : -ESRCH; } - -static inline void binder_alloc_set_vma(struct binder_alloc *alloc, - struct vm_area_struct *vma) -{ - unsigned long vm_start = 0; - - /* - * Allow clearing the vma with holding just the read lock to allow - * munmapping downgrade of the write lock before freeing and closing the - * file using binder_alloc_vma_close(). - */ - if (vma) { - vm_start = vma->vm_start; - mmap_assert_write_locked(alloc->mm); - } else { - mmap_assert_locked(alloc->mm); - } - - alloc->vma_addr = vm_start; -} - static inline struct vm_area_struct *binder_alloc_get_vma( struct binder_alloc *alloc) { @@ -793,7 +772,7 @@ int binder_alloc_mmap_handler(struct binder_alloc *alloc, buffer->free = 1; binder_insert_free_buffer(alloc, buffer); alloc->free_async_space = alloc->buffer_size / 2; - binder_alloc_set_vma(alloc, vma); + alloc->vma_addr = vma->vm_start; return 0; @@ -983,7 +962,7 @@ int binder_alloc_get_allocated_count(struct binder_alloc *alloc) */ void binder_alloc_vma_close(struct binder_alloc *alloc) { - binder_alloc_set_vma(alloc, NULL); + alloc->vma_addr = 0; } /** -- 2.37.2.789.g6183377224-goog