From patchwork Tue Oct 10 18:23:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13415850 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1C15CD8CAF for ; Tue, 10 Oct 2023 18:23:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7EAE18D00D8; Tue, 10 Oct 2023 14:23:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 74CAC8D0002; Tue, 10 Oct 2023 14:23:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5C5E28D00D8; Tue, 10 Oct 2023 14:23:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 4E2348D0002 for ; Tue, 10 Oct 2023 14:23:21 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 206A012014D for ; Tue, 10 Oct 2023 18:23:21 +0000 (UTC) X-FDA: 81330374202.03.3AFA27A Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by imf26.hostedemail.com (Postfix) with ESMTP id 455A0140015 for ; Tue, 10 Oct 2023 18:23:18 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mZ2Lq0L5; spf=pass (imf26.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696962199; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=LMA7kWpWolO6o46k4syPx6Ijzen7WBJLxGU37wBIQCk=; b=n7S4lggcY10SmR5xwA0+Cy7ogEejXIsQA3iMxXT1V1m2kMk34FSb10wiG3p9lfilGcPrwG BC9Ak0bAnDSUqiYs8POHGTj3/ctQjSmKzSCPqv9NAgKV75m8w6awLk9kkdXPAWeBwLGL/x llqGN5KXuLcKjIl9g4vCGsgMoWI+E8M= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696962199; a=rsa-sha256; cv=none; b=RP7slVywrVKlJqav+xTmtz1SV1HQfDy44BALp5HbNG46+2XznLAsb5d3jND1Y+i9269j3R JhSDryQmJpbpoYXk2WdcDMpsr5E/lS0vCeMO5QRI+ZJvknUbvqGeIPYCsWkE2vFD5y162S owIgtTxnAYH2R9HV9NZUPnh9dYNgY8I= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=mZ2Lq0L5; spf=pass (imf26.hostedemail.com: domain of lstoakes@gmail.com designates 209.85.128.54 as permitted sender) smtp.mailfrom=lstoakes@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-4066241289bso56205825e9.0 for ; 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=kvack.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=mZ2Lq0L5DNYL7rb919rrNl9dlvM9sUQ1CMiQomJgdh6oO2KfH7TR1H9uPnfvuhxM8i 2mI7zJmB5aXGyyBD/waZmNpaCHm8zUgg07cYOtn980S3/4plD+Lf/GS3jtcYgc4ucJm8 kjbodBsooQRGiRn/yers34e4WeCsrw9p532gbR/N3i73z1nthCheVC3cdqWkp3m4qbnL 84eB/yL8tUOeNcQGu+2FtB1x2y/FSj9zsDIL/Hs9QNU0w19MREk19RcZHvu4xDaAuf68 8pv8XM+ztpdeSjgvEyZVuiu9MSaPjNNXXO3SjS4+3KgzXcLSgxqAEKsYziT3cVsdooWI LL8Q== 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=W8DmnBFrG7yN/baUF0Ea/aFAWuQI0o6pkmlIB8ZY+yVRBWAoICV+dTpncfgDpm+ZK2 dieYr3unE+yzuY8+YYRPKUb/RDjQh4NLFA2ujV6a7hEJ2NyBn/qvklKFeNZW555rJk4Z VxMY39ZC1hcQgu8QyALzt8h0inVk6yMm7rEE55TsJXNSbD/5pLu68IM9SPg7As3dCWem 7jiCu+UtCeuBn6z0K4Gc+dejRBxGNtDOfKIicixbCsNyjwDoMy7m2A/YjXTGztOGEk4v FEp+mlAK4q50rCoVSqzIlNLUVrAY5p2JooeoXjG4cRldg+ZFIKWi+uAZFErBhIPBFJ8Z 8vPQ== X-Gm-Message-State: AOJu0Yxt4C6fwe3Ih+9SG0CvCb5MNgznKUotW6zqk4O69FbXMZVr+Ufa 1igk0xQJETpWHSrav9HOYWHsWqL7OCM= X-Google-Smtp-Source: AGHT+IGLDXNqqFWzIJ3E5UNJ3YGOQGfTcbbOw8jJXvvcOCrF/m9VHiUs0OpxJ5FyKLoXpbpIYlkq4w== 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 X-Stat-Signature: wkopki1er8d9okcrijohsttghgwc76sg X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 455A0140015 X-Rspam-User: X-HE-Tag: 1696962198-684618 X-HE-Meta: U2FsdGVkX1+JJZWS4MnZQ7edo/DS5vFTNfYYAV6CiUZlSZnO4S7UaoS1Fpq/NS5Rz5F5fnXz7ixUcOXSxsZ9XKGMt44Yq1wHDMO884xq5ucA+8nH5fjpiv4779tLBxXQNPe160cMQoP4fBV0wH03gvuhvPL5YvXjN/z2wllu1QHgKoATohzM9zw83pWE66JINscw0+2KpGysnuJV8DxlA/ZC9Bd3vm6YSd4oDdYvxhmiSrS3K0+07qsBnCyzxPdQ6nMzfP1TrHz1iEQqFUds7CjFXBqRb571QoRl+LMaIXft82MsTbuL4WDEZYnI94u+z190d/rJydDMpN4n5pNmh3VA6x9A5dLB5b0IIPnvJDb6GmMsDCkcNMSt4iW4Lsly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1Sd1wA9kKh2XvzXOyWWPbL36QRdlo7PY18S6edgxy X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;