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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12C61C9832F for ; Mon, 28 Sep 2026 08:44:03 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0964310E8BE; Mon, 28 Sep 2026 08:43:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="Jp0AvcBc"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 793D910E03B for ; Sat, 26 Sep 2026 09:41:22 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 1C08043E2E; Sat, 26 Sep 2026 09:41:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3E8C81F000FF; Sat, 26 Sep 2026 09:40:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1790415681; bh=0u13dbBevDvvrKeztStjJV2PV5yx6LiZibgW9CGmgFg=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=Jp0AvcBc2qFPX1KUyqat5xOo7kolWDkC6C0w6P6DaUvXm5iSIG2CZI03JVCmdPvQ2 vFXKg46qQ6h6qbDwt9b4xtSV8aaaHLKGAB793g+poJ3xMYhkIZo7xqXL5RLvULfLUx vltnCfE9F9DOd8HFLd4r2r4Sg0lUuE/yF336VcdgoJJtQs97NrE8ayt+3eU4eDKxGI oItyuRRw3Cj0jyhydyYqR3Mm1CDYrci/+rQrHCVid7DDrx80EwRj+MiAUgyhESJ7FS iOAhXbJnk5J5uDUKfyr1oX15QJ3wMcCu5lNOsTEzc+QVqHwaov8/ApQZu8GqGu9l4+ gmVl8+MdCcOZA== Date: Sat, 26 Sep 2026 10:40:50 +0100 From: "Lorenzo Stoakes (ARM)" To: Arnd Bergmann Cc: Andrew Morton , "Liam R. Howlett" , "Vlastimil Babka (SUSE)" , Jann Horn , Pedro Falcato , "David Hildenbrand (Red Hat)" , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Jonathan Corbet , Greg Kroah-Hartman , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Paul Moore , Stephen Smalley , Jaroslav Kysela , Takashi Iwai , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Eduard Zingerman , Kumar Kartikeya Dwivedi , Zi Yan , Baolin Wang , Nico Pache , Ryan Roberts , Dev Jain , Barry Song , Lance Yang , Usama Arif , "Kirill A. Shutemov" , Doug Gilbert , "James E . J . Bottomley" , "Martin K. Petersen" , Jaya Kumar , Simona Vetter , Helge Deller , Sebastian Reichel , John Hubbard , peterx , Masami Hiramatsu , Oleg Nesterov , Peter Zijlstra , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Rik van Riel , Harry Yoo , Juri Lelli , Vincent Guittot , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Dave Airlie , Will Deacon , "Aneesh Kumar K.V (Arm)" , Nicholas Piggin , Muchun Song , Oscar Salvador , Matthew Wilcox , Jan Kara , Marc Zyngier , Oliver Upton , Catalin Marinas , Madhavan Srinivasan , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Alexander Gordeev , Gerald Schaefer , Heiko Carstens , Vasily Gorbik , "David S . Miller" , Andreas Larsson , Alexander Viro , Christian Brauner , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , Chris Li , Kairui Song , Kemeng Shi , Nhat Pham , Baoquan He , Youngjun Park , Johannes Weiner , Qi Zheng , Shakeel Butt , Axel Rasmussen , Yuanchu Xie , Wei Xu , Chengming Zhou , Michal Hocko , Miklos Szeredi , Xu Xin , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-usb@vger.kernel.org, linux-rdma@vger.kernel.org, selinux@vger.kernel.org, linux-sound@vger.kernel.org, bpf@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Linux-Arch , linux-fsdevel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, fuse-devel@lists.linux.dev, Takashi Iwai , Emil Tsalapatis Subject: Re: [PATCH v3 00/40] mm: make VMA flag semantics explicit, eliminate VM_SPECIAL Message-ID: References: <20260917-b4-mmap-prepare-vma-flag-sanify-v3-0-4583d8a23bca@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Mailman-Approved-At: Mon, 28 Sep 2026 08:42:42 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sat, Sep 26, 2026 at 12:06:22AM +0200, Arnd Bergmann wrote: > On Thu, Sep 17, 2026, at 18:22, Lorenzo Stoakes (ARM) wrote: > > > > mm/vma.c | 246 +++++++++++++++++++------- > > Hi Lorenzo, > > I see that in linux-next there is a new build failure in some > configurations in code that you are changing here: Thanks for the report! > > mm/vma.c: In function '__mmap_region': > mm/vma.c:3083:1: error: the frame size of 1552 bytes is larger than 1536 bytes [-Werror=frame-larger-than=] > > I don't immediately see anything that you did that would have introduced > something bad that wasn't already there, so it's likely just gone from > just below the limit I was using for my testing to just above. The 1536 > byte limit is what I use on 64-bit builds with KASAN and otherwise > still has a clean build (with a small number of local fixup patches). Hmm are you specifying this limit manually somehow? > > What I see is that this function has multiple structures on the > stack that have nontrivial sizes: > > VMA_ITERATOR(vmi, mm, addr); /* 104 bytes */ > MMAP_STATE(map, mm, &vmi, addr, len,...); /* 384 bytes */ > struct vm_area_desc desc; /* 128 bytes */ > > The config that caused this is https://pastebin.com/raw/5M95qHy5, > which is an x86-64 build with CONFIG_KASAN_STACK enabled, and likely > a few other configuration options that made it a little worse. > KASAN_STACK tends to double the stack size used by structures > in order to catch out-of-bounds accesses. Yeah, there is a lot on the stack admittedly but there is also a lot of state being used. I'm sure we can reduce it. > > If I sprinkle some 'noinline_for_stack' annotations on functions > called by __mmap_region(), I can get the size down to 1144 in this > config, but that doesn't sound like a great workaround. > > The large stack usage is potentially harmful if this ends up > in call chains that have additional large stack usage (e.g. > kmalloc() leading to reclaim). Any ideas for how to reduce it here? That can never happen :) this call chain is _only_ for an mmap() call. > > Arnd In general I am absolutely taking this seriously and will find a way to reduce this, but my only question is whether this is actually something that needs to be done in this series? Because it's already huge and I would rather avoid adding yet another patch to it if possible. If I can do it as a follow-up that'd be ideal! Thanks! -- Cheers, Lorenzo