Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2111710rwe; Fri, 2 Sep 2022 08:39:48 -0700 (PDT) X-Google-Smtp-Source: AA6agR7lTobz5lVRSKY+iQ9BhHbesrrfwB7pplqfRF71cvK2pQm1NJULBsFYqLlHxUENwz1P+t+I X-Received: by 2002:a05:6a00:2349:b0:537:f249:e453 with SMTP id j9-20020a056a00234900b00537f249e453mr30878451pfj.34.1662133188122; Fri, 02 Sep 2022 08:39:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662133188; cv=none; d=google.com; s=arc-20160816; b=bvocNRBx5QgZGK59mRA5Jz1xOvs9sNo3ajYYVbhiidXo+wRoDvKL/wUPWLWBNNfQkV FgCimoptqqtcq6X6sm5fBqsbuEAjzVRYW3xFfAOjJJUKAxOa2ukXyXiQWVcHvvDnGda5 srnbMrbcwp35BxCbdqYqTw4o8bXGWDY3cBmVnfeHk8lMHRAlBhEKSmtqAmNbwhbDDMoo DQdlyLsqbe4dx+px0F30z/ALrDQCnyVmFZntuIr5nfLXZpT77b9OW97u8P5yqfSrhIb3 vyhGqcRqI0pxlzYRp3zVA2tsFYcmx5aW2SUAmrjYCBG0eTrt814/wEhdhIAbHtYEKcRw IrqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LfUeyyDPya+VM647W1kMLyuQpfGce9UnDrfOM4ed8c4=; b=r06aRLPYmav66YC8cZjE8ZQcFRIg6ZuUNMS824XRaoPXQeGp/1ehWr4YZx8wK/AaEL DnyFeGYXQmsZUfpa69pdSlEObQQk7a/ri8w6BRh8sDDxu9/9KFGkd24tSWsjnDdPGN0a zmGlnonI7oDKif2lNr2d7OTV48LG6PCaKguJaPAJbHDRjjJKwYLfPNHpM7kaMN5v+1wA ZCiGQCQgMAOnjZh4pTOw+HdIAi2SlkOMOUP8jqaUVrtkzjIC3RjVnc/KXIdSpM2ZJwbi UjXxLs0RkL+iqz05W13ZE9WbdvHWhZmmlZ/keCj+SudwQrY1DcVx4nFhtj3eUHU+79lF 8xLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=e0bgvUNt; 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 w5-20020a170902ca0500b0017312c86946si2046692pld.247.2022.09.02.08.39.35; Fri, 02 Sep 2022 08:39:47 -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=e0bgvUNt; 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 S236726AbiIBPOn (ORCPT + 99 others); Fri, 2 Sep 2022 11:14:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236694AbiIBPOP (ORCPT ); Fri, 2 Sep 2022 11:14:15 -0400 Received: from mail-yb1-xb36.google.com (mail-yb1-xb36.google.com [IPv6:2607:f8b0:4864:20::b36]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37136DCFE8 for ; Fri, 2 Sep 2022 07:46:05 -0700 (PDT) Received: by mail-yb1-xb36.google.com with SMTP id p204so3454082yba.3 for ; Fri, 02 Sep 2022 07:46:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=LfUeyyDPya+VM647W1kMLyuQpfGce9UnDrfOM4ed8c4=; b=e0bgvUNt2OZOKlrz9Uhod/iPoeq/YHNuYYxXRXzkQZFnKZJPbP3w1MiVETfphi+oUY NnwADo8XUIa6iAJsnICK8/X5V0B2AIOUpZn+MxVC07Mg7fTnk+KN3Nxg2k89JrTfLEoS P/i4zedRfe8ZHQESbWl2MbNru29hysWZ55bDSzQd9ATfo5lCkmG7w/2WN+8quIl3Tc6+ ufdw88gWTnF/DyhiJsMEssR4BHxjWxCuTR5kjhtXGyT2FS4PXA4k3J+wIOTZc1s/8KeS 9CY0GPFl0aws7Gzo/0AfaSxU831snBW0fT23aqWB8RaAGN5QRaQdpwT3XXuFLQu2tIPI GT+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=LfUeyyDPya+VM647W1kMLyuQpfGce9UnDrfOM4ed8c4=; b=yr1+e0KzfcO/9jnCk8tkPADVnoU6ERzKBpsaFLJEvNcOzWda4aoOWvh3/ESlkGRgrM AKtNbDckKIgG7zlfZfCeNA19axukLhmlOowy/RqXRCvx/f2+imZ13mteYSTkup15vEWD fisshM2lT0TTpXEeIuIRT/UDcqcwolTI6LhIyD0+2kjHKlrNccz4tcfyO1eDRYevEuux tXlAkTcg8RM/J4pXkefsmetHzEwveIG3ClWT+d5xZ0DPPJq4bOSQGhqZgjqFDlznbRWs 4y0Gx2FYaCBjQ2mpUij6I08Vetkc9i9ZJOWOe14+jQJU5dDD6u76qWsCycFxtUNc4gUF ZbeA== X-Gm-Message-State: ACgBeo2C1wKqunH888sy4gQ1NWxO0rMFAI48OiQiZGv2gP2KXPxHWbS6 4TZ9UpfycA6h8eNvNM1NL9h3wGgoEP8OHz8BJfLsbQ== X-Received: by 2002:a05:6902:705:b0:695:b3b9:41bc with SMTP id k5-20020a056902070500b00695b3b941bcmr23371622ybt.426.1662129963987; Fri, 02 Sep 2022 07:46:03 -0700 (PDT) MIME-Version: 1.0 References: <20220901173516.702122-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Fri, 2 Sep 2022 07:45:53 -0700 Message-ID: Subject: Re: [RFC PATCH RESEND 00/28] per-VMA locks proposal To: Peter Zijlstra Cc: Andrew Morton , Michel Lespinasse , Jerome Glisse , Michal Hocko , Vlastimil Babka , Johannes Weiner , Mel Gorman , Davidlohr Bueso , Matthew Wilcox , "Liam R. Howlett" , Laurent Dufour , Laurent Dufour , "Paul E . McKenney" , Andy Lutomirski , Song Liu , Peter Xu , David Hildenbrand , dhowells@redhat.com, Hugh Dickins , bigeasy@linutronix.de, Kent Overstreet , David Rientjes , Axel Rasmussen , Joel Fernandes , Minchan Kim , kernel-team , linux-mm , linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_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 On Fri, Sep 2, 2022 at 12:43 AM Peter Zijlstra wrote= : > > On Thu, Sep 01, 2022 at 10:34:48AM -0700, Suren Baghdasaryan wrote: > > This is a proof of concept for per-vma locks idea that was discussed > > during SPF [1] discussion at LSF/MM this year [2], which concluded with > > suggestion that =E2=80=9Ca reader/writer semaphore could be put into th= e VMA > > itself; that would have the effect of using the VMA as a sort of range > > lock. There would still be contention at the VMA level, but it would be= an > > improvement.=E2=80=9D This patchset implements this suggested approach. > > The whole reason I started the SPF thing waay back when was because one > of the primary reporters at the time had very large VMAs and a per-vma > lock wouldn't actually help anything at all. > > IIRC it was either scientific code initializing a huge matrix or a > database with a giant table; I'm sure the archives have better memory > than me. Regardless of the initial intent, SPF happens to be very useful for cases when we have multiple threads establishing some mappings concurrently with page faults (see details at [1]). Android vendors independently from each other were backporting your and Laurent's patchset for years. I found internal reports of similar mmap_lock contention issues in Google Fibers [2] and I suspect there are more places this happens if people looked closer. [1] https://lore.kernel.org/all/CAJuCfpE10y78SNPQ+LRY5EonDFhOG=3D1XjZ9FUUDi= yhfhjZ54NA@mail.gmail.com/ [2] https://www.phoronix.com/scan.php?page=3Dnews_item&px=3DGoogle-Fibers-T= oward-Open > > -- > To unsubscribe from this group and stop receiving emails from it, send an= email to kernel-team+unsubscribe@android.com. >