Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5361335rwb; Tue, 17 Jan 2023 12:39:56 -0800 (PST) X-Google-Smtp-Source: AMrXdXvDk0RXXlW1nEB/M52uKMvZYBy0vHijPoCiiMxuk161PYBHTHyrxEagrIVNTgq1t+Z5d8eC X-Received: by 2002:a17:906:2a0f:b0:873:7108:c6a9 with SMTP id j15-20020a1709062a0f00b008737108c6a9mr1972838eje.32.1673987996651; Tue, 17 Jan 2023 12:39:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673987996; cv=none; d=google.com; s=arc-20160816; b=A97B5AIjHzKAlNGxxzFrNFSfvoRdB3zMi7JNeI6XZfQzNQSnIIA0c0OCDuArDzTM1u KWRXt4f2ZjqBpzdTFEHm+uTwYjNL1KUfIqsdUU/gTuP+hbNvXdby0Ws+pEpAOPil0vTl qCvmjj+aAjIDKdHNf8SENITMvVn7UOCJo1MAM6ORn3twS7rZkQGAkADeEcLP/5JmjyR1 8RMd1+kmldWwLyTej0+mU6aTF8dYBKi+ccuGCzWewJIc6/naqe798UUtd20PHI+MPGR8 BNb6jQggxY0mTV246Ggn8Wrch4yA2DMORY/6FYehuTsRMyP7FwD7VPKV1IOkupVIm6t/ gzYA== 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=WQstPUbztcQ3oNJU/jnXWE9GGqVn0CTYXvJ///cN2gs=; b=AHbpz+zok7ctDApWHTK+R2mTwvk6g2oPCPKIFrhHVGeLyb9skx6PPgC4cnkuKqg1Ie MT+saCGN0gBTkyYu3PVTORGfBlqZZ5UmibZP8ewX15S5mkKm2hiOdqQwvKPWT12jVW38 c4aNRSZnvENNAnIO2JM/W780XIeSS7gGlLnUR3dADwOBole8UYodMeMlFgtlhRgvMrzA Gqyivqh9ckKLOoEO7wFW2zLAdJ0UEZtUW23Y7oIg1cOU/mKsnCOqpgBnsXXUtbqHIK3q HZZKDFGOc0hUKKIqoWd/KSusEOgIj+fUy8nFuBsYyCiJT0oXvuPbXbozvrA8Z2A9lNbD MBzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=poslRgeb; 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 qa38-20020a17090786a600b0078d550c0272si11859579ejc.269.2023.01.17.12.39.44; Tue, 17 Jan 2023 12:39:56 -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=poslRgeb; 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 S235292AbjAQTev (ORCPT + 47 others); Tue, 17 Jan 2023 14:34:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230288AbjAQT1c (ORCPT ); Tue, 17 Jan 2023 14:27:32 -0500 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E66F689E7 for ; Tue, 17 Jan 2023 10:34:36 -0800 (PST) Received: by mail-io1-xd35.google.com with SMTP id i70so6078910ioa.12 for ; Tue, 17 Jan 2023 10:34:36 -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=WQstPUbztcQ3oNJU/jnXWE9GGqVn0CTYXvJ///cN2gs=; b=poslRgebD7N051xL0dlQ/s+Ezqw18K2i/MiyhjW69tD8Q8EWVF96k5wFPqBT68fIx4 UW+FBcvboauGVEVYcGOYlMCrKMALhEZA6FzdBO7hQ/yy98POithKQbpUgSoBLfCQX/0/ mJFhqGlui74HddUG5gvjSzhjV1UFMflKwN3ojHD7sq+Of/9IGSYd4RX0Bny2aHq9T6kz t/LR7AstaK1J+f+cW7PCcQlb6SZ7W7jpqeEYhVrnXFbSmdgrsuHVjXiM0XSUrm5lu0IF OLrxwCiYBNX5chzmqbr8AiRTqv2U25IqwvgeRrbnbHsVx3+eSncfTAhX20VyHDelBId/ G6rQ== 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=WQstPUbztcQ3oNJU/jnXWE9GGqVn0CTYXvJ///cN2gs=; b=MLQF/vUb3NoGEXIZL2ZoTb+l2U5UCKyYuFHMMxTE5vflt5ZjpcvCxHsHnkgtQJZ1df 3VPLGtNIs8eZyAPV5zy2+QTSdXE64tTuADXuqcA39KciTW1O4frxNHd3ye88f4dDH517 NUwyqt2fuNT1so4RmYg/MbwceqXThvcrOZu7SvPLeXCzclgt3XqXF3UsBlfSSXmwlEb1 qD56DCqcg4knb789Xvu8DTPFtDWhg3ElEw0T7nFaGaJVXU8PGogqUcAshJO/yYAe4SP1 iX2Vboptuh+aGbIKN773zn63K4oOhGiSey2kzFrt0fwew4IGq+tSQntqsVIEksTgCbEE vUBA== X-Gm-Message-State: AFqh2kqNnzFtADN/TzwR2TkSKOOwHQdq6UgCcCQD9Cpgjis7+wUqGrPv twwTQJHZuT91tSwCixYA+K2CGsVyy0a2AZ4y/bUWuw== X-Received: by 2002:a02:aa99:0:b0:38a:49b8:bc49 with SMTP id u25-20020a02aa99000000b0038a49b8bc49mr335554jai.66.1673980475940; Tue, 17 Jan 2023 10:34:35 -0800 (PST) MIME-Version: 1.0 References: <20230109205336.3665937-1-surenb@google.com> <20230109205336.3665937-41-surenb@google.com> In-Reply-To: <20230109205336.3665937-41-surenb@google.com> From: Jann Horn Date: Tue, 17 Jan 2023 19:33:59 +0100 Message-ID: Subject: Re: [PATCH 40/41] mm: separate vma->lock from vm_area_struct To: Suren Baghdasaryan 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 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)?