From mboxrd@z Thu Jan 1 00:00:00 1970 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 08A06CD68ED for ; Tue, 10 Oct 2023 06:46:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7E5666B01F1; Tue, 10 Oct 2023 02:46:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 795776B01F2; Tue, 10 Oct 2023 02:46:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65CE76B01F3; Tue, 10 Oct 2023 02:46:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 57B9D6B01F1 for ; Tue, 10 Oct 2023 02:46:13 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 206931CA56D for ; Tue, 10 Oct 2023 06:46:13 +0000 (UTC) X-FDA: 81328617426.03.34ADE41 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf25.hostedemail.com (Postfix) with ESMTP id C3F80A0006 for ; Tue, 10 Oct 2023 06:46:10 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=rqG5U9jG; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="Jm55PMk/"; dmarc=none; spf=pass (imf25.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696920371; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/y8kLlMYlCV5svpo9yVALD4uEnUsY8oZYm1/+BvVA3Q=; b=u+TH49d1qOgLk7aqkgk0YoAvhmy8hNNdn508ZEWnbBjxH0XhOJZzhkbmCeDqhISHoiHjeg zB0Jt51Ppub6H/Tn0lzY2uGtlpPvEkQEBemP4GxSGCMzMtxsd8SuHTqUwuRcXCAymP2kzJ ++z+Wm+m8wYlMcBTAomTl+BnDulUJXY= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=rqG5U9jG; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="Jm55PMk/"; dmarc=none; spf=pass (imf25.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696920371; a=rsa-sha256; cv=none; b=w2+atsp4fJX9m6rP3vshjSaY70LG6Ezwgn5RI/hOrjk2uMryASrZ6Zx2FouNfFWAoUqL/c MqwZ//OH26UXjMOLSV+KxdX6X9lHlD5f2kLuu4zNNeBCe3AeyD8XoP1if4DD6S8pScU2Dk 6AiQSwWkW+HzA4qP+diXe8aBGHRsGss= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 7D7641F45E; Tue, 10 Oct 2023 06:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1696920368; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/y8kLlMYlCV5svpo9yVALD4uEnUsY8oZYm1/+BvVA3Q=; b=rqG5U9jG9vYBLFqamcNVJxVoEtokWyP4Gjwzx/armsgwiFOgTkZCHPJXvVVa+xUM4R9hqr B8ilRIR5dylzWBJgz1Hr51Dx7d1TkaP9GojhpQEfA730DT9JsqzmfCdMgpkpUYOHhe2p8e RNfwYctosg22nHnudZiP8L5nee0Ys5A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1696920368; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/y8kLlMYlCV5svpo9yVALD4uEnUsY8oZYm1/+BvVA3Q=; b=Jm55PMk/8f0PObDJ7v9TdL7FBNKQKTbiFh51HR6OLr3uWmV83RHH5XgfOMyTNzxZtb+daY ozC0H3tqPC5qSzBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 573591358F; Tue, 10 Oct 2023 06:46:08 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GLCBFDDzJGUOJwAAMHmgww (envelope-from ); Tue, 10 Oct 2023 06:46:08 +0000 Message-ID: <52d4760a-9d4b-e3c0-d236-5eaa0eb5f96a@suse.cz> Date: Tue, 10 Oct 2023 08:46:07 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH v2 1/5] mm: move vma_policy() and anon_vma_name() decls to mm_types.h To: Lorenzo Stoakes , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Alexander Viro , Christian Brauner Cc: "=Liam R . Howlett" , linux-fsdevel@vger.kernel.org References: <4f1063f9c0e05ada89458083476e03434498e81e.1696884493.git.lstoakes@gmail.com> Content-Language: en-US From: Vlastimil Babka In-Reply-To: <4f1063f9c0e05ada89458083476e03434498e81e.1696884493.git.lstoakes@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C3F80A0006 X-Stat-Signature: a47zee6mia8zw65b6g165ktp599kgu9d X-HE-Tag: 1696920370-235027 X-HE-Meta: U2FsdGVkX1/pq+VHgpsxOYaljlQFiIbKQ5WOrx7WNe/1uhuc1E8/hKcALYecYO24hpzMolrksukX2R+p8+m5bnBA4lsOU8NO3ZOEc0IPBGIoxzgkcJ91p1ngnmNK8lFTjJMK3Jcks+tDi1rTH/pZmpkx7sM7ZG6Yq1XTnDeCEHhtKP4ED5Ckmm7FIFGFVU+9j+QkQKvw0PLRvciXmxzeVWvqgkUyApWP9VV73VVsRATziE5V88Cxz9Z82oU939Zd5wVmYDtvLlSRoIopGUUSxR9BBeV1gYiIxTq5RWbFbJdzHdmHMn+OsCBgOmHkmbqMnumXS/k3LGd/awt8h19Ws4Hq6ug45aIQrTQ4qYl6RmatpQnG4fbGL6lgIp7ZE8N6shqOWwYTkXevyMXMGUsBY7sEw3z0Bxj2ncVZEvQWJezn1utBlAscFTKGBlpnrmCNkTMNuyTNsuqdtflFsMONb7iwLb+OE8AtOcZwLPwOiFPRNrrYYNLLVnVNnvzomwZm5UyyCds1sXcxOBntpQzTDkBkNrzIL3F3EcDd7HrPy8x8/1A77q7eXpomEbvwtEIX2AT76A4t2of+Sn4vXn16Jec/LjbjKqRB1fsA4GA/ukIjYMY+2m4cl7EUc9frUVj97WbKHwx1UgwJ4dCD3F13740vd341XRD/qjqBq8u/Kf5qniu4TUZubOQ06+UrKb8gJphal0qDNNrvb88JBvFZbfGQ9q2Mv1flkCEi/Fo/8v+pmOzKqmXE7v5EvpyEo84/Wd4tsoqXQ71M5P4KTgksHW0JK8K0xC8KRXgC1jSQpsmosiUjvDBaRW9VoFlZ3a/sJXXpp2HdBnMB6m/FVwhtquC+QbiTC5jMzgBLMeNoddUmTPpC5d1djLEkbhQSU/tLjq9SFLSL+3ew/05JFT90hWUJa0d4hZnJjhavNKFiYovJTSAGkJp6w0ZCzaMupItHP+fk3MLGfFvKqHnvJm4 o5cQ0eWG DbBCyg+ACrEgDoO4EldnzXF1X1ts/CpLTGDQksXiAbFjDBj7ennaWTvYNTsFkqYiGYzKUIm0RAqg9S1BdVe34R9JU87oifMd6689n+KeSBXWQy7BlyIdkRynRVDwa18vNpAKKIKnBeqaMAO6q+UcXGhiU2bwld3f6YkJ2aMn0aS5TxnHxAY5nDOkhuvLWQgjvGQZJj/Ek+46W9Za2VHoGzEyeUZrPtyUYl3T8gTQ/aQ1uA8ZwgVexg9tHM47jL2+ofUiWiVrPocjB/wO1y3J+yWP0VmZWFi3COUp+qPFIoiZN+B8= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 10/9/23 22:53, Lorenzo Stoakes wrote: > 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 Reviewed-by: Vlastimil Babka > --- > 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;