Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2549198rwb; Sun, 6 Aug 2023 22:09:43 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHoeoS/Np8lcBxHEoWv+m316xkvaD7CsHMqr0in0B0BqIuPciyWsCPkcDAA1Azhzdt80qZG X-Received: by 2002:a17:903:181:b0:1b5:1467:c4e8 with SMTP id z1-20020a170903018100b001b51467c4e8mr9201021plg.15.1691384982719; Sun, 06 Aug 2023 22:09:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691384982; cv=none; d=google.com; s=arc-20160816; b=mK5QCXN+DR+1sRs9s0y0BJa7AwKfccazyG04gqjR3YfMg1+EK0TSst/+vZjg7rFDa6 kiIq/KAeRiNCSlReYkAaFaskLii0MBWrdtV0+Mcrp2OE1n5u5EiIWvkWmrVbFGx8OjLb LdmO8aMJjzql+33R1xBV93alUWDPpKntMi6R6BsIswRyEHE8m5UkMIV/OxDTEzrFjP6r 3z3G28Gux36lMQ7KDGXJe7UbTZjmjHsfdTSa83dCJ19rTBlLWeE/llYThSvlOtFlHZpz MaiT+Oh5stbqpiTY5RMT0mUC61OJ/6iMDsjoJ5wdgFMXsAzNONT3SuFqn1hqMKcoO+N+ 7AGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=mrJGK7xolmy7+30+SP6QcPep8mA36OiN+uaIxGFlkBw=; fh=/I7Un4lUFKJ/l9zWynC2k7r/CgC+h+k+qm5er6LROoI=; b=WNERjIFbjeY9IwwbkBY9Q1JvbwPSeNRq+UempixfE+G3SJCgUHZDwDbL8a5FATBz9F 4No3QoKRhVME9jG6Ro14FxvGze/Q6Zk92hRVktboptu/Rs/fGBE0xl53bza1RLkJT/aU AhEaztC6ktghtUNyK44ywJJW3EX/+7kQGkrykDq5/Krnej+tiWpzCjMJurjbfF++FipU AEG0A3OtGqcrKPgrvw3pcXP96fFeBAo917hzv+4IZdIOTT9FnTXhi+CcHAq1/bgXA/Ik x8aiAxDvuYg0G2qj8lEyzBAGvi10BIjIhkcFyKZuJpzCPHO18sAGgh1BtJ+DD8158gsC jbCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=fHYhJwBW; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c13-20020a170902d48d00b001b8a70d11e4si5234044plg.529.2023.08.06.22.09.30; Sun, 06 Aug 2023 22:09:42 -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=@infradead.org header.s=casper.20170209 header.b=fHYhJwBW; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbjHGDDz (ORCPT + 99 others); Sun, 6 Aug 2023 23:03:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbjHGDDx (ORCPT ); Sun, 6 Aug 2023 23:03:53 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DCE9170B for ; Sun, 6 Aug 2023 20:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=mrJGK7xolmy7+30+SP6QcPep8mA36OiN+uaIxGFlkBw=; b=fHYhJwBW43fhUdx0xdp6D5QHf+ 55sr6rFVnJ5VLQBVaMNLGIlPAo8GcPHHZ/Fe395R0gAudV0f2vm5tDMhU1GkdMODztAnJDyOEAeEu g0gS90RXQcnLviWMEvBMZArEB/Pi4xYmjULReOe9h8f8jRIRRuJf4dIaV0GHP51g4UpFQCp+ceMB5 2vqu12++RzjanEGjMHOi5LNM//pC8ctt+RIYIT6F0XYCNrlT2edy/EkHtIWH95MFDEXIiihg1FxIc co3YGxBQgODDfA67cUld6gx762nwT3m/PWib9uUD8DRVsovqslcXFnMHqCbO3DPmLp3RvBFoPm3M+ pc/lT/GQ==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1qSqX4-007zHX-Ut; Mon, 07 Aug 2023 03:03:46 +0000 Date: Mon, 7 Aug 2023 04:03:46 +0100 From: Matthew Wilcox To: Mateusz Guzik Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: move dummy_vm_ops out of a header Message-ID: References: <20230806231611.1395735-1-mjguzik@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230806231611.1395735-1-mjguzik@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE 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, Aug 07, 2023 at 01:16:11AM +0200, Mateusz Guzik wrote: > Otherwise the kernel ends up with multiple copies: > $ nm vmlinux | grep dummy_vm_ops > ffffffff81e4ea00 d dummy_vm_ops.2 > ffffffff81e11760 d dummy_vm_ops.254 > ffffffff81e406e0 d dummy_vm_ops.4 > ffffffff81e3c780 d dummy_vm_ops.7 > > While here prefix it with vma_. It really shouldn't be prefixed with vma. Other than that, I love this patch. > [if someone has better ideas where to put it, please move it] > > Signed-off-by: Mateusz Guzik > --- > include/linux/mm.h | 6 +++--- > mm/init-mm.c | 2 ++ > 2 files changed, 5 insertions(+), 3 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index 406ab9ea818f..14898e76bbf1 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -756,17 +756,17 @@ static inline void vma_mark_detached(struct vm_area_struct *vma, > > #endif /* CONFIG_PER_VMA_LOCK */ > > +extern const struct vm_operations_struct vma_dummy_vm_ops; > + > /* > * WARNING: vma_init does not initialize vma->vm_lock. > * Use vm_area_alloc()/vm_area_free() if vma needs locking. > */ > static inline void vma_init(struct vm_area_struct *vma, struct mm_struct *mm) > { > - static const struct vm_operations_struct dummy_vm_ops = {}; > - > memset(vma, 0, sizeof(*vma)); > vma->vm_mm = mm; > - vma->vm_ops = &dummy_vm_ops; > + vma->vm_ops = &vma_dummy_vm_ops; > INIT_LIST_HEAD(&vma->anon_vma_chain); > vma_mark_detached(vma, false); > vma_numab_state_init(vma); > diff --git a/mm/init-mm.c b/mm/init-mm.c > index efa97b57acfd..cfd367822cdd 100644 > --- a/mm/init-mm.c > +++ b/mm/init-mm.c > @@ -17,6 +17,8 @@ > #define INIT_MM_CONTEXT(name) > #endif > > +const struct vm_operations_struct vma_dummy_vm_ops; > + > /* > * For dynamically allocated mm_structs, there is a dynamically sized cpumask > * at the end of the structure, the size of which depends on the maximum CPU > -- > 2.39.2 > >