From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.3 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B186DC43331 for ; Fri, 27 Mar 2020 05:09:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6CD0620663 for ; Fri, 27 Mar 2020 05:09:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="uqmMlcSL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6CD0620663 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E46146B0010; Fri, 27 Mar 2020 01:09:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DF7AA6B0032; Fri, 27 Mar 2020 01:09:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D0D666B0036; Fri, 27 Mar 2020 01:09:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0250.hostedemail.com [216.40.44.250]) by kanga.kvack.org (Postfix) with ESMTP id BBA856B0010 for ; Fri, 27 Mar 2020 01:09:24 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7B70E181AD0A3 for ; Fri, 27 Mar 2020 05:09:24 +0000 (UTC) X-FDA: 76639963848.02.lift89_6f360999a7a53 X-HE-Tag: lift89_6f360999a7a53 X-Filterd-Recvd-Size: 4600 Received: from mail-yb1-f194.google.com (mail-yb1-f194.google.com [209.85.219.194]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 27 Mar 2020 05:09:24 +0000 (UTC) Received: by mail-yb1-f194.google.com with SMTP id h205so3904740ybg.6 for ; Thu, 26 Mar 2020 22:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=ohnZNgjDeOcrrgII3KrdEi2hNuGyHzs9U8pjD+WsuTc=; b=uqmMlcSLr/aJyGrLVFPoqWyksk03NI8a822IT0j0ft9YIBJiatFbXJVZy6u11D3R2c DgA+Pwgg5I3SZJYi//NjgjU+dinJO7EryHfQ72Vy7O7dQdldLL+/gP1clOCR82l3G8TV T7jTETFt3pV6NkuJLQ3NZFYesU3RfZWs18NSK0EcDemZpzM40PA3p6S72AYdbZwfGa36 r/zkM6Yu9WLvaAWoSEGc1cxHfWvFirvTZvZHGzngBQu+YVpAKGu1qSTue1tboiV+r1at m/JShFaIse/ZGkCThuuAadKwrkWDi0Ps8aDb8YO8bji08z+Ysi5lVvks09p0W2KbJFFd 6m+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=ohnZNgjDeOcrrgII3KrdEi2hNuGyHzs9U8pjD+WsuTc=; b=s+dyLbuQLFFQUFDTlX3gUB7aqhAMx+kHip8hed6AXMQHZUdI8AmY+ghPgWFf2SALA8 +rFoGT96xzJahTM30xVFHpJgHpB1eg9gsN5QzSVfkgQ3Idk2flnZWk2Q7qX1eaTKrg3/ NTOv7tNsuTXUck6m1YCwGfNYN1qCiEG+MqmIKLuGhxzPi3pmt7FQkxbAc5pFtLTN7nLS +Yz2ACc2qQNirfeoe1LI9WbxTZPKfIycpw5C8pbT4tCXG5FzMHAaiZIH2NBzoOO1/80K HfOIV8HaUUBq5n+gEyS4vCttiivQnzpkh1nvm2eTifyDhTcPuZKOjoa1p4pBesgoAoyo 9ELg== X-Gm-Message-State: ANhLgQ1oRnX+zNVkOtvP1w8ngjhffwik4tQvXWMryZc/QO+qoq4lvzks ShDQHdaqfQ92xzF90jDLf9S2e18GzCnZWacNpBLHjg== X-Google-Smtp-Source: ADFU+vtpDbHudptQ7FfWw0e+/cwVeNaEqIblGpv1l/3zEkMwrkgEw3XL9Mjg3v3rXDPcpFZmqedQwIGQiCFyFXqU4YU= X-Received: by 2002:a25:bb0c:: with SMTP id z12mr17920472ybg.253.1585285762971; Thu, 26 Mar 2020 22:09:22 -0700 (PDT) MIME-Version: 1.0 References: <20200327021058.221911-1-walken@google.com> <20200327021058.221911-8-walken@google.com> <20200327044647.wgfsmjy37n72dixe@linux-p48b> In-Reply-To: <20200327044647.wgfsmjy37n72dixe@linux-p48b> From: Michel Lespinasse Date: Thu, 26 Mar 2020 22:09:09 -0700 Message-ID: Subject: Re: [PATCH v2 07/10] mmap locking API: add mmap_read_release() and mmap_read_unlock_non_owner() To: Michel Lespinasse , Andrew Morton , linux-mm , LKML , Peter Zijlstra , Laurent Dufour , Vlastimil Babka , Matthew Wilcox , Liam Howlett , Jerome Glisse , David Rientjes , Hugh Dickins , Ying Han , Jason Gunthorpe , Markus Elfring Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Mar 26, 2020 at 9:48 PM Davidlohr Bueso wrote: > > On Thu, 26 Mar 2020, Michel Lespinasse wrote: > > >Add a couple APIs to allow splitting mmap_read_unlock() into two calls: > >- mmap_read_release(), called by the task that had taken the mmap lock; > >- mmap_read_unlock_non_owner(), called from a work queue. > > > >These apis are used by kernel/bpf/stackmap.c only. > > I'm not crazy about the idea generalizing such calls into an mm api. > We try to stay away from non-owner semantics in locking - granted > the IS_ENABLED(CONFIG_PREEMPT_RT) warning, but still. > > Could this give future users the wrong impression? What about just > using rwsem calls directly in bpf? I see what you mean and I certainly don't want to encourage any new non-owner call sites to appear.... This bpf stackmap site is a small pain point in my larger range locking patchset too. I am not sure what is the proper response to it; the opposite side of your argument could be that using a direct rwsem call there hides the issue and makes it less likely for someone to fix it ? I don't have a very strong opinion on this, as I think it can be argued either way... But at a minimum, I think it'd be worth adding a comment asking people not to add new call sites to the mmap_read_release() and mmap_read_unlock_non_owner() APIs ? -- Michel "Walken" Lespinasse A program is never fully debugged until the last user dies.