From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 245F747277F for ; Thu, 2 Jul 2026 11:40:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782992439; cv=none; b=DK2GkzDPv9QL+QNOAdqbyNSVM8u8XKnQCA6cgd3E/JwXxMSqSM4EQIfdBjPfEWGjhwAr+UUYQL+xtcJt+olCOm6yYuDttJTeIg2NCsbE6XNjgBiYAwBNMwrYkCPoLwi9Pl69GPFxOCLmaCIekkCUV9eidtKLlKw3cxcve57tTsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782992439; c=relaxed/simple; bh=/KU+qwds20JhaSAHS/0qK/0mpH1n/3CgmSllPI3f0zw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gS41GlEyCrp8kAOvjp9ciEEASji9i+FbKHDzxjH7FKigVY9RxFSpgnriURSiF7kmueaUti+TY7LqKs734Z+u4kIpVM2U5x9Esmbo8fkYiH/jHIzjr9d818IPfZgUseW0rbi71q3R8rzVixvIGx0voM6iF+NCNRLy8hUpulFrF64= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Zh8gMbcs; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=vtJW1UBj; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=Zh8gMbcs; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=vtJW1UBj; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Zh8gMbcs"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="vtJW1UBj"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="Zh8gMbcs"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="vtJW1UBj" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 9145C75B6A; Thu, 2 Jul 2026 11:40:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1782992436; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cYFKxI5JULp8gb+ekuRNTWlzvX21cjaKiqCcXlOBcMI=; b=Zh8gMbcsGVZsWYcj7s6NxFpfr5kyL+dCesoL+NYZ+EODYF9IH6Hd/X0L9JWcLlDuAVVzRD lkFU6fooAwjkvyipCSd6pYrI7ul5JbqcH2WSEGXi2kMhtzt1GEarB+i/bLdIQKj10vBGbz EhZtRvw0lzIZvhvJ2rPwW99GAu7sGKs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1782992436; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cYFKxI5JULp8gb+ekuRNTWlzvX21cjaKiqCcXlOBcMI=; b=vtJW1UBjyxnbfNoeO2SWUq2seB26JDH9poeuyJMl+C0R4u0Xqidess1m7AhGShw5crqNPY FyMzXeg34AXEWFBA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1782992436; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cYFKxI5JULp8gb+ekuRNTWlzvX21cjaKiqCcXlOBcMI=; b=Zh8gMbcsGVZsWYcj7s6NxFpfr5kyL+dCesoL+NYZ+EODYF9IH6Hd/X0L9JWcLlDuAVVzRD lkFU6fooAwjkvyipCSd6pYrI7ul5JbqcH2WSEGXi2kMhtzt1GEarB+i/bLdIQKj10vBGbz EhZtRvw0lzIZvhvJ2rPwW99GAu7sGKs= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1782992436; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=cYFKxI5JULp8gb+ekuRNTWlzvX21cjaKiqCcXlOBcMI=; b=vtJW1UBjyxnbfNoeO2SWUq2seB26JDH9poeuyJMl+C0R4u0Xqidess1m7AhGShw5crqNPY FyMzXeg34AXEWFBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 16BA4779AA; Thu, 2 Jul 2026 11:40:32 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 1gA3AjBORmrpAgAAD6G6ig (envelope-from ); Thu, 02 Jul 2026 11:40:32 +0000 Date: Thu, 2 Jul 2026 12:40:30 +0100 From: Pedro Falcato To: Lorenzo Stoakes Cc: Andrew Morton , Russell King , Dinh Nguyen , Simon Schuster , "James E . J . Bottomley" , Helge Deller , Jarkko Sakkinen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Ian Abbott , H Hartley Sweeten , Lucas Stach , David Airlie , Simona Vetter , Patrik Jakobsson , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Dmitry Baryshkov , Tomi Valkeinen , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Christian Koenig , Huang Rui , Ankit Agrawal , Alex Williamson , Alexander Viro , Christian Brauner , Dan Williams , Muchun Song , Oscar Salvador , David Hildenbrand , Suren Baghdasaryan , "Liam R . Howlett" , Matthew Wilcox , Marek Szyprowski , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Masami Hiramatsu , Oleg Nesterov , Steven Rostedt , SeongJae Park , Miaohe Lin , Hugh Dickins , Mike Rapoport , Kees Cook , Paolo Bonzini , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-parisc@vger.kernel.org, linux-sgx@vger.kernel.org, etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-tegra@vger.kernel.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, nvdimm@lists.linux.dev, linux-mm@kvack.org, iommu@lists.linux.dev, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, kasan-dev@googlegroups.com, damon@lists.linux.dev, Rik van Riel , Harry Yoo , Jann Horn Subject: Re: [PATCH 27/30] mm/vma: correct incorrect vma.h inclusion Message-ID: References: <22d0f4e3fe11f6fd1312734e242d008267ad142c.1782735110.git.ljs@kernel.org> Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <22d0f4e3fe11f6fd1312734e242d008267ad142c.1782735110.git.ljs@kernel.org> X-Spam-Flag: NO X-Spam-Score: -2.80 X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; SUSPICIOUS_RECIPS(1.50)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_CC(0.00)[linux-foundation.org,armlinux.org.uk,kernel.org,siemens-energy.com,hansenpartnership.com,gmx.de,redhat.com,alien8.de,linux.intel.com,mev.co.uk,visionengravers.com,pengutronix.de,gmail.com,ffwll.ch,suse.de,oss.qualcomm.com,ideasonboard.com,nvidia.com,amd.com,shazbot.org,zeniv.linux.org.uk,linux.dev,google.com,infradead.org,samsung.com,goodmis.org,huawei.com,vger.kernel.org,lists.infradead.org,lists.freedesktop.org,lists.linux.dev,kvack.org,googlegroups.com,surriel.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; ARC_NA(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TAGGED_RCPT(0.00)[]; RCPT_COUNT_GT_50(0.00)[75]; RCVD_VIA_SMTP_AUTH(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,pedro-suse.lan:mid] X-Spam-Level: On Mon, Jun 29, 2026 at 01:23:38PM +0100, Lorenzo Stoakes wrote: > The only files which should be including vma.h are the implementation files > for the core VMA logic - vma.c, vma_init.c, and vma_exec.c. > > This is in order to allow for userland testing of core VMA logic. In this > cases, vma_internal.h and vma.h are included, providing both the > dependencies upon which the core VMA logic requires and its declarations. > > Userland testable VMA logic is achieved by having separate vma_internal.h > implementations for userland and kernel. > > Callers other than the core VMA implementation should include internal.h > instead. This header does not need to include vma_internal.h as it only > contains the vma.h declarations, for which the includes already present > suffice. > > Update code to reflect this, update comments to reflect the fact there are > 3 VMA implementation files and document things more clearly. > > While we're here, slightly improve the language of the comment describing > vma_exec.c. Two random thoughts: 1) perhaps vma.h -> vma_private.h 2) https://lore.kernel.org/all/CAHk-=wghMm2c+AYEcwYY7drSVXB27DYqc-ZXpFiq=XFs-w59wA@mail.gmail.com/ mm/vma/whatever.c :) would PROBABLY solve the issue of people snooping vma.h > > No functional change intended. > > Signed-off-by: Lorenzo Stoakes Reviewed-by: Pedro Falcato > --- > mm/mmu_notifier.c | 2 +- > mm/nommu.c | 1 - > mm/vma.c | 4 ++++ > mm/vma.h | 9 ++++++++- > mm/vma_exec.c | 8 ++++++-- > mm/vma_init.c | 4 ++++ > mm/vma_internal.h | 4 ++-- > 7 files changed, 25 insertions(+), 7 deletions(-) > > diff --git a/mm/mmu_notifier.c b/mm/mmu_notifier.c > index 245b74f39f91..df69ba6e797f 100644 > --- a/mm/mmu_notifier.c > +++ b/mm/mmu_notifier.c > @@ -19,7 +19,7 @@ > #include > #include > > -#include "vma.h" > +#include "internal.h" > > /* global SRCU for all MMs */ > DEFINE_STATIC_SRCU(srcu); > diff --git a/mm/nommu.c b/mm/nommu.c > index ba1c923c0942..4fef6fbbd6e9 100644 > --- a/mm/nommu.c > +++ b/mm/nommu.c > @@ -41,7 +41,6 @@ > #include > #include > #include "internal.h" > -#include "vma.h" > > unsigned long highest_memmap_pfn; > int heap_stack_gap = 0; > diff --git a/mm/vma.c b/mm/vma.c > index d727150e377a..5c3062e0e706 100644 > --- a/mm/vma.c > +++ b/mm/vma.c > @@ -4,6 +4,10 @@ > * VMA-specific functions. > */ > > +/* > + * To allow for userland testing we place internal dependencies in > + * vma_internal.h and external VMA API declarations in vma.h. > + */ > #include "vma_internal.h" > #include "vma.h" > > diff --git a/mm/vma.h b/mm/vma.h > index 155eadda47aa..f4f885615a92 100644 > --- a/mm/vma.h > +++ b/mm/vma.h > @@ -2,7 +2,14 @@ > /* > * vma.h > * > - * Core VMA manipulation API implemented in vma.c. > + * Core VMA manipulation API implemented in vma.c, vma_init.c and vma_exec.c. > + * > + * Note that, in order for VMA logic to be userland testable, this header > + * intentionally includes no dependencies. > + * > + * This is specifically scoped to mm-only. Users of this functionality (other > + * than the core VMA implementation itself) should not include this header > + * directly, but rather include internal.h. > */ > #ifndef __MM_VMA_H > #define __MM_VMA_H > diff --git a/mm/vma_exec.c b/mm/vma_exec.c > index 0107a6e3918c..c0f7ba2cfb27 100644 > --- a/mm/vma_exec.c > +++ b/mm/vma_exec.c > @@ -1,10 +1,14 @@ > // SPDX-License-Identifier: GPL-2.0-only > > /* > - * Functions explicitly implemented for exec functionality which however are > - * explicitly VMA-only logic. > + * Functions provided for exec functionality which however are > + * specifically VMA-only logic. > */ > > +/* > + * To allow for userland testing we place internal dependencies in > + * vma_internal.h and external VMA API declarations in vma.h. > + */ > #include "vma_internal.h" > #include "vma.h" > > diff --git a/mm/vma_init.c b/mm/vma_init.c > index a459669a1654..715feee283f0 100644 > --- a/mm/vma_init.c > +++ b/mm/vma_init.c > @@ -5,6 +5,10 @@ > * between CONFIG_MMU and non-CONFIG_MMU kernel configurations. > */ > > +/* > + * To allow for userland testing we place internal dependencies in > + * vma_internal.h and external VMA API declarations in vma.h. > + */ > #include "vma_internal.h" > #include "vma.h" > > diff --git a/mm/vma_internal.h b/mm/vma_internal.h > index 2da6d224c1a8..4d300e7bbaf4 100644 > --- a/mm/vma_internal.h > +++ b/mm/vma_internal.h > @@ -2,8 +2,8 @@ > /* > * vma_internal.h > * > - * Headers required by vma.c, which can be substituted accordingly when testing > - * VMA functionality. > + * Headers required by vma.c, vma_init.c and vma_exec.c, which can be > + * substituted accordingly when testing VMA functionality. > */ > > #ifndef __MM_VMA_INTERNAL_H > -- > 2.54.0 > -- Pedro