Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp329113rdg; Tue, 10 Oct 2023 11:23:33 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEtXIwKfPSqCFkvMr0WXeKMVPA0zqcdS1zm/Z6RNlD33pNBDGGZlS535daIqV+RATY1xMvl X-Received: by 2002:a05:6a20:914e:b0:15d:42d5:6cb5 with SMTP id x14-20020a056a20914e00b0015d42d56cb5mr17875685pzc.28.1696962212743; Tue, 10 Oct 2023 11:23:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696962212; cv=none; d=google.com; s=arc-20160816; b=iOGENE8/wzgk2s3HxEidaUs1UNvKa36fAnrNRM/I0ek6+ZaGbWhM+YUjR8yHBwWOS+ pSBfpiyHwOBAWr6e5JTAunqi5TCiCbKNHDcr1SMNR9WvvecWnlsl7LEHlKeoih8/OOVY KlSoNzpfHMAEOSQGG4jK4PiQTWVdvRhk9A0onv4PGj8y/o2JdmLd2btTyMJHdTdfnWNx aSKO4INbqIoLIt4BQOJbgFgGet5tbAXsjUJW6QTt55pp8RSzSNgzgo/74gjIfW4CiU56 KVqwgwnEfvXZ5f7UKl+7n6UpeSr4UY3nzgqWwwEVzAjhZY4Yg1FA7fdykpsc6LdlKlP7 Ag/w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LMA7kWpWolO6o46k4syPx6Ijzen7WBJLxGU37wBIQCk=; fh=t0e8hB1yztay3y0yczBzLM0YwGerH6s+dnvwo2ZuqJs=; b=HCbfd/9eWHXzUCnf9Dn4VRGQdeVSbsOTg+Iv7nNnIfPE8bCm2qcqJzHNKZ+JMuzC1+ fc6s5gMf+f+wOWBKdgRDjxi8nDIOl1PP7CRpQM2URPVUIB/rGDnn+FtZeGihpK9KCdL1 wHguylwppqvS9RzB/4M1vY3dTIZjPw/no/i9sSPRumqLmLGnvzIMcl5xY0S5WPJCYigV MAzJ5SBrvWunMdKVsSCb9nqG46yaXoPhlITeQGNIXSvGqtfPZhkDqaodHRXZWHZUr1++ tPPmLD+tpOzPDaEQ/xdzqunnQENMxMgS3GXmyOR7MjxzGT9Y0LcJP5aVGZXQnHAsOAcH fdlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k0poowsH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id i14-20020a655b8e000000b005891f64e423si12520073pgr.781.2023.10.10.11.23.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 11:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=k0poowsH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CF5D3802C8DC; Tue, 10 Oct 2023 11:23:31 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234079AbjJJSXZ (ORCPT + 99 others); Tue, 10 Oct 2023 14:23:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233954AbjJJSXU (ORCPT ); Tue, 10 Oct 2023 14:23:20 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05D9DAC; Tue, 10 Oct 2023 11:23:19 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-4075c58ac39so4068025e9.3; Tue, 10 Oct 2023 11:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696962197; x=1697566997; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LMA7kWpWolO6o46k4syPx6Ijzen7WBJLxGU37wBIQCk=; b=k0poowsHvG8WaWKjxGDXJCPHXy3n7T8gxk3TPrThbGhgGQU8HzY25xEEuSFY3MHMzP ysMu33LWDsRG067OG/CL1v1jqiDeg3kpat8czY58R/WxGlILLaNN7/Erfo09E3891Q8Y wmqORgj5q/uVRIurZOhWKZnHmAVK/RvK/ECjD40o/hVzHWjwM1SB/EevTeZhupMNn1Ku 1ZFkIdmfLI7k00pWgBiNNKgrjPLV0dOtgOwgN9j2x+VtY5Teb2AJM2dchFsK/eDYTGd8 85QKdxKtgwjs40UgPIjUzCaYWFbtCGmwlN36q9Dcf4DcOnl8xkoqSlUbpUz99Pc9aGCP 3lQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696962197; x=1697566997; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LMA7kWpWolO6o46k4syPx6Ijzen7WBJLxGU37wBIQCk=; b=LmS5+xHEkxG+yKZVRca7blBFOOuTKHufG8L0WIct1cVjSA8IoVxmA5WzQxojD5XLqX Hper/DndLCnk/dcTQQ4DPkH1p2DLL+RiVmeN/b/14IFJnezT7uQhgUEpyf0KzYWaYkWJ 9kF1l5Tzon/1ozqzoEK8GBP799cLv8KZUTRUGkOIu0QyQFKeACW/5a4j3j9z8HwXZ/DM EOh+ZGOYJY4f2KqYlkyr4Fc8vOPO3wFol/qcv/d9AfErQmSTCk2BQ5fEnzyaHpYZuXj9 d55q2JGp4lNR6NCld/hE7bj18JowpKHJMsU+c9GyCWCwMqwZZiI4ybF2kCS0RHFllrEt NQSA== X-Gm-Message-State: AOJu0Yxyuh+3wWv1F4O8/okLwIJ/3t2+4s9dyrhcwvc09vHrdD0npX+i ngkkIfPgXP0SycEth81et7Q= X-Received: by 2002:adf:8b95:0:b0:32d:81f7:d6f2 with SMTP id o21-20020adf8b95000000b0032d81f7d6f2mr464917wra.30.1696962197081; Tue, 10 Oct 2023 11:23:17 -0700 (PDT) Received: from lucifer.home ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.googlemail.com with ESMTPSA id j16-20020a5d6190000000b003217cbab88bsm13225312wru.16.2023.10.10.11.23.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 11:23:15 -0700 (PDT) From: Lorenzo Stoakes To: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Alexander Viro , Christian Brauner Cc: "=Liam R . Howlett" , Vlastimil Babka , linux-fsdevel@vger.kernel.org, Lorenzo Stoakes Subject: [PATCH v3 1/5] mm: move vma_policy() and anon_vma_name() decls to mm_types.h Date: Tue, 10 Oct 2023 19:23:04 +0100 Message-ID: <24bfc6c9e382fffbcb0ea8d424392c27d56cc8ca.1696929425.git.lstoakes@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 10 Oct 2023 11:23:32 -0700 (PDT) The vma_policy() define is a helper specifically for a VMA field so it makes sense to host it in the memory management types header. The anon_vma_name(), anon_vma_name_alloc() and anon_vma_name_free() functions are a little out of place in mm_inline.h as they define external functions, and so it makes sense to locate them in mm_types.h. The purpose of these relocations is to make it possible to abstract static inline wrappers which invoke both of these helpers. Reviewed-by: Vlastimil Babka Signed-off-by: Lorenzo Stoakes --- include/linux/mempolicy.h | 4 ---- include/linux/mm_inline.h | 20 +------------------- include/linux/mm_types.h | 27 +++++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h index 3c208d4f0ee9..2801d5b0a4e9 100644 --- a/include/linux/mempolicy.h +++ b/include/linux/mempolicy.h @@ -89,8 +89,6 @@ static inline struct mempolicy *mpol_dup(struct mempolicy *pol) return pol; } -#define vma_policy(vma) ((vma)->vm_policy) - static inline void mpol_get(struct mempolicy *pol) { if (pol) @@ -222,8 +220,6 @@ static inline struct mempolicy *get_vma_policy(struct vm_area_struct *vma, return NULL; } -#define vma_policy(vma) NULL - static inline int vma_dup_policy(struct vm_area_struct *src, struct vm_area_struct *dst) { diff --git a/include/linux/mm_inline.h b/include/linux/mm_inline.h index 8148b30a9df1..9ae7def16cb2 100644 --- a/include/linux/mm_inline.h +++ b/include/linux/mm_inline.h @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -352,15 +353,6 @@ void lruvec_del_folio(struct lruvec *lruvec, struct folio *folio) } #ifdef CONFIG_ANON_VMA_NAME -/* - * mmap_lock should be read-locked when calling anon_vma_name(). Caller should - * either keep holding the lock while using the returned pointer or it should - * raise anon_vma_name refcount before releasing the lock. - */ -extern struct anon_vma_name *anon_vma_name(struct vm_area_struct *vma); -extern struct anon_vma_name *anon_vma_name_alloc(const char *name); -extern void anon_vma_name_free(struct kref *kref); - /* mmap_lock should be read-locked */ static inline void anon_vma_name_get(struct anon_vma_name *anon_name) { @@ -415,16 +407,6 @@ static inline bool anon_vma_name_eq(struct anon_vma_name *anon_name1, } #else /* CONFIG_ANON_VMA_NAME */ -static inline struct anon_vma_name *anon_vma_name(struct vm_area_struct *vma) -{ - return NULL; -} - -static inline struct anon_vma_name *anon_vma_name_alloc(const char *name) -{ - return NULL; -} - static inline void anon_vma_name_get(struct anon_vma_name *anon_name) {} static inline void anon_vma_name_put(struct anon_vma_name *anon_name) {} static inline void dup_anon_vma_name(struct vm_area_struct *orig_vma, diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index 36c5b43999e6..21eb56145f57 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -546,6 +546,27 @@ struct anon_vma_name { char name[]; }; +#ifdef CONFIG_ANON_VMA_NAME +/* + * mmap_lock should be read-locked when calling anon_vma_name(). Caller should + * either keep holding the lock while using the returned pointer or it should + * raise anon_vma_name refcount before releasing the lock. + */ +struct anon_vma_name *anon_vma_name(struct vm_area_struct *vma); +struct anon_vma_name *anon_vma_name_alloc(const char *name); +void anon_vma_name_free(struct kref *kref); +#else /* CONFIG_ANON_VMA_NAME */ +static inline struct anon_vma_name *anon_vma_name(struct vm_area_struct *vma) +{ + return NULL; +} + +static inline struct anon_vma_name *anon_vma_name_alloc(const char *name) +{ + return NULL; +} +#endif + struct vma_lock { struct rw_semaphore lock; }; @@ -662,6 +683,12 @@ struct vm_area_struct { struct vm_userfaultfd_ctx vm_userfaultfd_ctx; } __randomize_layout; +#ifdef CONFIG_NUMA +#define vma_policy(vma) ((vma)->vm_policy) +#else +#define vma_policy(vma) NULL +#endif + #ifdef CONFIG_SCHED_MM_CID struct mm_cid { u64 time; -- 2.42.0