Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5365475rwb; Tue, 17 Jan 2023 12:43:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXshh5lnoX3lnxfO2qn3L+VKgbD4ZgtsLSr91hX9fCQvIT0c9t2fiKdVgeHb4jQ4ao9yynbM X-Received: by 2002:a17:907:1248:b0:84d:45db:b203 with SMTP id wc8-20020a170907124800b0084d45dbb203mr3676884ejb.12.1673988232691; Tue, 17 Jan 2023 12:43:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673988232; cv=none; d=google.com; s=arc-20160816; b=B4jVJ1xsxx9V+NMwtQq8B+hAWVu7pu5HBcwa+nNp2xgOe6XWRJ6qAiL77Z6YeUv0sk GLDmBaTkeptk3ZqB7EmMvV0022ks7O2snVl0wPJLoKIXB5IrIIeXTd3cyotjkYruXJ/r xEe/un1bOhFmZfBmj0E0pJme+dddH5veBhZy2YevRSPIryFlHdIBxNB1qApOj1Nx6IMD XoEWy5o2wdPZb3I1e+wg+SkOKVsUBOH/NWAn5gyXS227L6goclxYZutYN8DIHRwVFbfy UOBrvrpmi54B550utVSN8zJx912Eew3S5AhHlLGM2aHkqpDAFzP1zS5E5Miw5jYgu60q NjvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=LIZZvFyQtXHixD5sWfvEaQUvi24ljYnGZNh2fBEIyp4=; b=HnyXwPMRz2E9lcKxX92CmBPueBlB5jw4FP+gDO8R8qh/0ot8eVNSUwky8MAGqbRI7i ZOmiCWrr2s9pv+eX+zhYDaUegP+7e4zI7odsYd8wb/4mtCPPlCuTokWfwYZ49QacxV9I kLAFnoLXzF4IhEoNrKOmMwnph3iTIRVp2m4IGDT9T+U/ZlQ8PyL9o5hx99h1uo6UDjxg ej79b0LXmHdZHiU2l1TyK3fYKssFTdf+PfsBauSjkui6/nVlrv2I7yi1MKW61G96PHOA tie2046J7PPPBO/OyHYArqEKEc9yOLhiLqOIVZaPAY2ycsDh0lsOpT70x0nSmlmXEETt 98LQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=CjLP+GN4; 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 qw30-20020a1709066a1e00b008716ac51aeesi3089924ejc.248.2023.01.17.12.43.40; Tue, 17 Jan 2023 12:43:52 -0800 (PST) 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=CjLP+GN4; 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 S231419AbjAQULT (ORCPT + 49 others); Tue, 17 Jan 2023 15:11:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234263AbjAQUHS (ORCPT ); Tue, 17 Jan 2023 15:07:18 -0500 Received: from mail-yw1-x1134.google.com (mail-yw1-x1134.google.com [IPv6:2607:f8b0:4864:20::1134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 676BF3FF19 for ; Tue, 17 Jan 2023 11:01:19 -0800 (PST) Received: by mail-yw1-x1134.google.com with SMTP id 00721157ae682-4c131bede4bso436004177b3.5 for ; Tue, 17 Jan 2023 11:01:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LIZZvFyQtXHixD5sWfvEaQUvi24ljYnGZNh2fBEIyp4=; b=CjLP+GN4eJ8YGFZvjoqXnYn0mL/Nm9o57f+7WOJDJDHEjmOn/4ZZF6+enYJUFh56p6 ZjMUPNGSRgQRosE3EMtoX1RXdV9HlQD3govS4EbUA9vX5E0lvyII7jNgKbkxa9q55Ofi 5fHxRCrBasHddp+A5FhlnIGxMd1HsMsFjjUSptfu2Xn/GYum5SsgoXsfxk+bQ6S1eMxn TjquS1QRX6eEGqUoWMTLZ0Uen7LLC6vfFjMFZvmVjQlE+SMKypaTTEwOKRHnLLugiZMU Ca7UGjlXIklsuObkggD1KlRzV4LfytQE7UWnMkJIywJkawE+81OksYcPHkL0icjcL46L ZAWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=LIZZvFyQtXHixD5sWfvEaQUvi24ljYnGZNh2fBEIyp4=; b=k3XtvN9KtVQaimpV4ThfrF4s2x8dQbKe8JWDVNJ2CxQPYqj6m5y75L0oz67n/y6UJR Agz8pB69BjSJZDfMexqd8xyEoRYO0gmmnMpBdQJXAZjTq0MCDObxEcq5os2+vJwLgzri b3CjjIEdtdhRNp+WXCJydVSYEpxDJT0H4p0zBpqtHRvXYzCK+qYG0U7UjKovjlZkdQqX 7TQzWyfiKciKte1oufqazF8Cmh9k0XiHRvQ7sRm6V3Pb2AGPLkb0l05oZNVrwZWHHB4c wXEbaaLi5IRFwyezrGq1Lo+E6gcY1OC3D6VPkcLckhbYK6IfOpf/GbaBMNYbsg0Zpsny DcOw== X-Gm-Message-State: AFqh2koozn9jdZ1Lrjcfxbw7AiuJJmW/rPwoOLHvFgi7B/Vz1PfmaBf0 TQgGKmnKPv078+AM/xLyHlg+BUhrwhzHroKSxMRIEg== X-Received: by 2002:a81:9105:0:b0:3dc:fd91:ef89 with SMTP id i5-20020a819105000000b003dcfd91ef89mr459982ywg.347.1673982078402; Tue, 17 Jan 2023 11:01:18 -0800 (PST) MIME-Version: 1.0 References: <20230109205336.3665937-1-surenb@google.com> <20230109205336.3665937-41-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 17 Jan 2023 11:01:07 -0800 Message-ID: Subject: Re: [PATCH 40/41] mm: separate vma->lock from vm_area_struct To: Jann Horn Cc: akpm@linux-foundation.org, michel@lespinasse.org, jglisse@google.com, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, mgorman@techsingularity.net, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, peterz@infradead.org, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com, paulmck@kernel.org, luto@kernel.org, songliubraving@fb.com, peterx@redhat.com, david@redhat.com, dhowells@redhat.com, hughd@google.com, bigeasy@linutronix.de, kent.overstreet@linux.dev, punit.agrawal@bytedance.com, lstoakes@gmail.com, peterjung1337@gmail.com, rientjes@google.com, axelrasmussen@google.com, joelaf@google.com, minchan@google.com, shakeelb@google.com, tatashin@google.com, edumazet@google.com, gthelen@google.com, gurua@google.com, arjunroy@google.com, soheil@google.com, hughlynch@google.com, leewalsh@google.com, posk@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com Content-Type: text/plain; charset="UTF-8" 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, 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 Tue, Jan 17, 2023 at 10:34 AM Jann Horn wrote: > > On Mon, Jan 9, 2023 at 9:55 PM Suren Baghdasaryan wrote: > > vma->lock being part of the vm_area_struct causes performance regression > > during page faults because during contention its count and owner fields > > are constantly updated and having other parts of vm_area_struct used > > during page fault handling next to them causes constant cache line > > bouncing. Fix that by moving the lock outside of the vm_area_struct. > > All attempts to keep vma->lock inside vm_area_struct in a separate > > cache line still produce performance regression especially on NUMA > > machines. Smallest regression was achieved when lock is placed in the > > fourth cache line but that bloats vm_area_struct to 256 bytes. > > Just checking: When you tested putting the lock in different cache > lines, did you force the slab allocator to actually store the > vm_area_struct with cacheline alignment (by setting SLAB_HWCACHE_ALIGN > on the slab or with a ____cacheline_aligned_in_smp on the struct > definition)? Yep, I tried all these combinations and still saw noticeable regression.