From patchwork Sun Aug 6 23:16:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mateusz Guzik X-Patchwork-Id: 131636 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1156431vqr; Sun, 6 Aug 2023 17:50:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE44TThBJfOnZGskkW6x8HadS0+DPo+PIeQz60f/u8VrCGPa1VAl73wLZJBlkuvZBOMqujR X-Received: by 2002:a05:6402:8c6:b0:522:2ce0:d80a with SMTP id d6-20020a05640208c600b005222ce0d80amr5976431edz.35.1691369405801; Sun, 06 Aug 2023 17:50:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691369405; cv=none; d=google.com; s=arc-20160816; b=a3adDmnGSRLHCZksNJRpfq5cYIA1uGiDUKFEISSdyx2ESwIWYmoeA1Sfj93ZV6KaZY aph/95rEwjl8c4nlcC9+5sUui/gG7v2nleHttCVUrBVgU/7QhbCsbTPbgAAKEd1nptjw mDNSZ5Fxy++Y552H2LDgTQ2Ggl4m+RlE7/a2DwG/dkgrmeJv9rHlV5typvETWpM6fcMO n4jbno5HZh729W/MloG1df++ylk3IlPLna+vxe4dobFqsCP3v0ppjCIx/lk5pbpfq5Gc nJy0jNdHr1msW4dd77Da0eDZ16VlnLBLp2JjUvSpJDnfLWiamc4GGF6brTzU+UC/9zEp xsRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=iEbIB04Iy3FmDryo9/HW6q1xbIuRl/P3QhBN14yV5sg=; fh=oNxOkpNN+8jHybHW1SOn6d/368TEhmzboGvqduKI8eA=; b=RyicQhz2EEgNM06fRyMDCbKs2h+MVcQmIh8e2izZakqkH7GNAFksO8qiOQs4RQAyjJ 9y8rkyy/BVqdZ9S29x2d4XIkh0XwPSJddhqDHgA3l6G1U4W9JeYTtqBboAjLJ99EcXkl JefdQ4cQFiA67banEudNv7ViS+3B7EJ4Bp2nDimZAuuCun5W4oINRdwjxuo8xPiaPZmM TXQ/4Q8MJgLF6NE55KLUAeZES/LmAfaUQxKWzvMwV2Ho4z76M/YBA3wTePKtJDkXYzM7 p9uOGVOPkUQoejZ0ZrD9hWOrw01iKJwehTfkbId018oCsiwyk4muT4aT18AAskZ5Pgtm THPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="q5/30O30"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a056402151100b00522d8edd982si5116408edw.667.2023.08.06.17.49.43; Sun, 06 Aug 2023 17:50:05 -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=@gmail.com header.s=20221208 header.b="q5/30O30"; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230028AbjHFXQV (ORCPT + 99 others); Sun, 6 Aug 2023 19:16:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjHFXQT (ORCPT ); Sun, 6 Aug 2023 19:16:19 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8BDADF4 for ; Sun, 6 Aug 2023 16:16:18 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4fe0fe622c3so6125808e87.2 for ; Sun, 06 Aug 2023 16:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691363776; x=1691968576; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iEbIB04Iy3FmDryo9/HW6q1xbIuRl/P3QhBN14yV5sg=; b=q5/30O30q4Bup1+Nynv0E/0oPlPnyiyZAJMEQLopNYUDrkqh6wUXcfRIibwjceqtiq 5XD0GDNC4EUWsDhgoqccCkptC6CZRzhqbjApu3BBjDZQkAj+b4lu6Ybi0saI7Qj3tAIw 6lVFfHRaT5ApkR3AsJTaWarE7dpHpXG25az1hHh03pHXDYM3z6iu60sddloDJEPBUJHU 2FcEYHi2R47NBQG3xlD0xiFokEnCKHAanzT7kpZa2J1iPEMT9DA6p3J0uXFNbUUYLIPM G76zlS2clXd2vfbPdrMB7nlm4gUi3/UGaSGOBcoG6bAYi4t9ghNZSng2U8MqYq9CYEXT Xxkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691363776; x=1691968576; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=iEbIB04Iy3FmDryo9/HW6q1xbIuRl/P3QhBN14yV5sg=; b=YUO+1sb+JCXaMG0Y9ZREaQOYW44ziMRpc4/bADe/A9J6pH8zb39MLRjQBDauQJ6CQ9 RYl8cyNktu94ugHs1CpZR+dx9YGpnD61/cr+TpJwXbWM42ibzy3q78HrbKznrYkwIuQS goTxhCUv4/UaU94r3sxNgxDQGufY/tSbHrE7VsfaNmVqyylipHl8YUFsleXbtAVQHshQ VSaud2Faj7H1tIViP/JmU3wQsKVKIa3xG83LJpoif42HqTbavP6r42nTZ86aea1XdEbD 9Y3/KlZNDpOp7bdziGK6Ooa4KU8FWG+Odvp9LARJln9LDOoq42zzhXlYkTHkDSmdaubk qCfA== X-Gm-Message-State: AOJu0YxZp5YZdMBF75zgCWnF3Zz8zIypGJCMhjAhONUAf+/LhOSNrYzi 1QPNH8UdspeggZYsn0K4NXc= X-Received: by 2002:a05:6512:401b:b0:4fd:c785:58b with SMTP id br27-20020a056512401b00b004fdc785058bmr5022776lfb.4.1691363776275; Sun, 06 Aug 2023 16:16:16 -0700 (PDT) Received: from f.. (cst-prg-21-219.cust.vodafone.cz. [46.135.21.219]) by smtp.gmail.com with ESMTPSA id bt16-20020a0564020a5000b005226f9d6055sm4337575edb.61.2023.08.06.16.16.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Aug 2023 16:16:15 -0700 (PDT) From: Mateusz Guzik To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mateusz Guzik Subject: [PATCH] mm: move dummy_vm_ops out of a header Date: Mon, 7 Aug 2023 01:16:11 +0200 Message-Id: <20230806231611.1395735-1-mjguzik@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773529365966231501 X-GMAIL-MSGID: 1773529365966231501 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_. [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