Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp2133936rdb; Mon, 9 Oct 2023 13:54:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFSkw38U/pZ2ZwEQdqD7PBStFsy4LDEO1DwH5x2+Hmku3DFhDyUUmEWwI6Cqe+H6q3ggZhP X-Received: by 2002:a05:6a20:7485:b0:15e:e0fd:98e7 with SMTP id p5-20020a056a20748500b0015ee0fd98e7mr19707325pzd.20.1696884880837; Mon, 09 Oct 2023 13:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696884880; cv=none; d=google.com; s=arc-20160816; b=vjy7AoEyeiFmkkaE7GF3Jm10Zjywxw8O7dUfyPaUe9S11eK4uYzsqMTjgCuWfcWkQD xWOJXztKOO9crFZTpBG3OXEjx/5zmGZy+jyxZzBca5Z1VxJDOH0KIwkpqMi2i+QHR3c+ /ASX7KTMmT21vJj6IAPOLSwXbRiCI3oXVs3YeFRsyzOj+DUdGwet6dyanBJGsH2i0Dur DnaCsb/skxrb2QiWaUk2hLN6hwC+YSC+j1hdPxJg3ZX0g/WXH+tVcAIGbrrj8qWcOie/ mc6w/nZQOofxZzSdo3CYMEvaa/79x8oBX62XvtVP6Hf33LFOMBoG0PKGRoWfYJMvUbzb 8LoA== 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=jochmgf2oxyHl1Fdsf6/Z0vhz675AmN7EMJ3Y7JXYH0=; fh=t0e8hB1yztay3y0yczBzLM0YwGerH6s+dnvwo2ZuqJs=; b=HnpocYx6P4W/zk9DsVDLYfvAt8G+K8q1ItIQAmNGiiz1fEdO59KgTmruT3IM9S4RoK aGWxXnW68tBl1Y9CcOzyb41BCuKgTMgYDE+2KyZfWWuAe6Fqg+pCtadpvCEMsKAjrJoC e0guB79syKHbpmPMq0jP5skH3O4SPkT8pbTqSN2jLr965zeetD671Q1D3Qy7rKdGCBt/ Y9Ax7Y+N12vq3enazqL5KHzhcmWlPDJCbL0zorELXazwNnDVsscf5St1eBM6tWpC079E M9M+zcvtLuOXYHRRTK5bONn9ZSP2k8k7zEqzbP2xDn41BlZCRxbq6YRuJXOrngMaP8Vd 66gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BlWJ928c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 23-20020a630f57000000b0057759a5b7ccsi7431515pgp.305.2023.10.09.13.54.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 13:54:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BlWJ928c; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 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 howler.vger.email (Postfix) with ESMTP id 89FE98047DA8; Mon, 9 Oct 2023 13:54:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378034AbjJIUxm (ORCPT + 99 others); Mon, 9 Oct 2023 16:53:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1377082AbjJIUxj (ORCPT ); Mon, 9 Oct 2023 16:53:39 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 52E80A6; Mon, 9 Oct 2023 13:53:36 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-3226cc3e324so4909135f8f.3; Mon, 09 Oct 2023 13:53:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696884815; x=1697489615; 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=jochmgf2oxyHl1Fdsf6/Z0vhz675AmN7EMJ3Y7JXYH0=; b=BlWJ928czCmxUXHE9yDaFekmYQwrwx2M2dTJanSHnTnpcm46T43q+2BbSriIBCggCI omrl1Hfstn+EySkzfXES7l05BZrUMEGxPu8Ctszr2DakSA0ODmPzjdFBXTqAawUwHmj0 4ORfBid86/rdQzFAwUQ90zyDRafz5K+7ZXTPbB90eSciLoYvtUbwOyIqLea37vvXaIRV u4Yop//TPjkvD+Y+86Nk4OW2s8f1IRQ9IZE65DweR1lLxBE5qsI+2pmQkjcqsY2ThOBx 7HKphHQvdAo3ajbOjGs2/Mi81owBKUhZqXPYT+fFTG1yYOIVdbmAifiaWe2+DSEeKRuk bTZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696884815; x=1697489615; 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=jochmgf2oxyHl1Fdsf6/Z0vhz675AmN7EMJ3Y7JXYH0=; b=hUBdnKbt1nxxm0tYc9wLT6/QT3L4uAetdR/b0h9wAZpIhQ5S8g+GnSGLldFnGReWwd fxl3m9vERc6Gx1ZYIxorP0nEpuKJ8u9xaF7uDND+Jzsc64TiSo+bCmoc8IWkQsWE/lQQ Lds3dU+PzyoGUepjAD1mFDMOqSOOJicqIDnvdKzmVfEhrYw4HetlfK6oF9el+oor7DOZ z2nKpaG8ITgBX0frc2PaZVprazC8cyPpeqFcytVJ9sS1u2GZN6BvGdpvL8E/zB/bXeTQ cn5vqGrkJ0IWSObPLGOg5NPmqQX8l61HL2R8TVmTHH/eJ5ywUNXJ1DangG23B4EKONOV aTgg== X-Gm-Message-State: AOJu0YzsRxZC4gVm4uXNZtcea7uKnBBXfJVx7kK5yXHt1NosP11fPoe5 seK08Ze2CG0Fs6xrhsJJu/8= X-Received: by 2002:a5d:4dcc:0:b0:321:62b0:7ad8 with SMTP id f12-20020a5d4dcc000000b0032162b07ad8mr14148854wru.16.1696884814438; Mon, 09 Oct 2023 13:53:34 -0700 (PDT) Received: from lucifer.home ([2a00:23c5:dc8c:8701:1663:9a35:5a7b:1d76]) by smtp.googlemail.com with ESMTPSA id l2-20020a5d4802000000b0031fe0576460sm10578130wrq.11.2023.10.09.13.53.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 13:53:33 -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 v2 1/5] mm: move vma_policy() and anon_vma_name() decls to mm_types.h Date: Mon, 9 Oct 2023 21:53:16 +0100 Message-ID: <4f1063f9c0e05ada89458083476e03434498e81e.1696884493.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=3.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_SBL_CSS, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Mon, 09 Oct 2023 13:54:37 -0700 (PDT) X-Spam-Level: ** 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. 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