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 23D03C369D9 for ; Wed, 30 Apr 2025 21:42:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF4F86B008A; Wed, 30 Apr 2025 17:42:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA3C66B00CD; Wed, 30 Apr 2025 17:42:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB91F6B00CE; Wed, 30 Apr 2025 17:42:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id AD0E96B008A for ; Wed, 30 Apr 2025 17:42:39 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id DD1595D7D7 for ; Wed, 30 Apr 2025 21:42:40 +0000 (UTC) X-FDA: 83392034880.01.1DECB59 Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by imf05.hostedemail.com (Postfix) with ESMTP id 386DB100007 for ; Wed, 30 Apr 2025 21:42:39 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="IHKlWHF/"; dmarc=none; spf=pass (imf05.hostedemail.com: domain of akpm@linux-foundation.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746049359; a=rsa-sha256; cv=none; b=K1XXGjavI2fjhh9bN9NOB4dGEbumAvs+IgssnBqOZ95eXhAmnnUR+scdQeEfnYyT3UC8fN CNVMWL307+mvRYCkbtGjWaEfIunQMSK37ws/GbK9ZzgwQEukIDQ0md2HiW3o77ELN1O9b+ QoMUHkVOu38u2ry0OqcdXP0BAkYepf8= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b="IHKlWHF/"; dmarc=none; spf=pass (imf05.hostedemail.com: domain of akpm@linux-foundation.org designates 172.105.4.254 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746049359; 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=RyR5i9T5kMZddgC9uu5LNvJe+1DY6pT96OG0/D4qXGM=; b=UpxEBlAqt6Xg7yeTXOS0PzOTqU+byRSkmr/hlIZcgEjkkeNjee1w34RNSOU7HWWvu04ozi 09vP0gO4u1yD0/XPwfnnhtSR1DUIvv+MSaJ4WUAtC1gQz322hRfWuqb1UYYV3KWkhDCYez 5OmyGV4zY9nhuGQIcQb4ZK2qxoBTBtU= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 3776C68499; Wed, 30 Apr 2025 21:42:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 61F1DC4CEE7; Wed, 30 Apr 2025 21:42:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1746049358; bh=k4XAgtgtNwr9oyFp+a3TQG0lb5TNlovWMjxoS8bejdo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IHKlWHF/kenWw9YiMtSsyWAvMScIeHKeQzzOtmvITzsFr2DdkjoR4GgWm6qPAliRz vmQDNeJGdbwxMeXxAFa6cwYzS8l0o3nGQop2a/OJGs0oT5HtFU8GbKOwBlMA9XX9g5 rml9acqyEdWI8fkqQWvmMPJFDuWPAmb08vJOlENw= Date: Wed, 30 Apr 2025 14:42:36 -0700 From: Andrew Morton To: Lorenzo Stoakes Cc: Vlastimil Babka , "Liam R . Howlett" , Jann Horn , Pedro Falcato , David Hildenbrand , Kees Cook , Alexander Viro , Christian Brauner , Jan Kara , Suren Baghdasaryan , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 4/4] mm: perform VMA allocation, freeing, duplication in mm Message-Id: <20250430144236.1877ef24177b40cc6a007874@linux-foundation.org> In-Reply-To: <5edc96cf-4f48-447f-b5a3-7e38679fa3f0@lucifer.local> References: <5edc96cf-4f48-447f-b5a3-7e38679fa3f0@lucifer.local> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 386DB100007 X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: ihjwr57ibkoadcoqkkrhi6pd88nc1nhf X-HE-Tag: 1746049359-942619 X-HE-Meta: U2FsdGVkX199Tln0EuaVtOo9kKVvS+B6/OuyoM9pxl4mcKj4Qcc7rTkGpsB/1Vy4aMjvaO9G9u5bYc3/Y0DSz1tU9PHgzsd0cGHsmDZRqd6H9RnGZPFHlXKEPQhE/ROMh/cQ35JEEzwc/HEWX1s56VZK6xx65tBL/7fprNF9OEe0G6N+JgsxvpZZ0TQs2e5ow/MBZqAJdDWXmkxce9n2uvC6ZQJBWXD5MsnowHhdAv/zaWr+s8qXqSxZC0VTwCjCtTw+cIqupR+4IQDTict/LWJG//JCgAnd8N2h4PyEY+onyVYdxcLBEtY1PzYR9FobnN612N+hUWToRh/Vpm9dNHqxbBaW5UMECYGuOFGyuHnOtxdmytpDVybcjpnIfYwnWzRvoatv6iPeyy4olwjuTR+bj3w+Oy7FZ/KX+/kFLJi7Jt5cfBNqfb+FL8ndomeX+eWP3UKZHUCHICJ0klIeoF8jJiHTbt21tIcdvnL77gwI60B+NzEDYbfCc/zdILm7XjtMDzGsPRAya6r+riRld5GfvswqhuJB3U1g8OcMW4W3d+/DvuERpP+MPdQ9cSmGnHbp0Zd2xZ6mXoNekZZJq0Oqcmy04ZPyc6nXIesX/0dNNQBXzhc5Mpf77Qm1kC0M7A9HMyc4loNikm99piVcGvgZQFjWfnVPraX2GdHI0b5/g+mkyig0Ssv/T3f9bOajxk0Tv9VegS7TSBg6UB59O7UzRVSFRz1nVUh7jAXRMjy826XrF2QYUmuDi7eQtLye9qmB7fUu2rSfmP6Rb8B7a3vmV4MP/bduPPygYMG9qAY98whVBLTBWyZMDJqIX1oNf2eIWf8sHXrzumTIEsJmFVvgl5R1MNfZrtDpPUijeKYVY05nPA2eKEuyU5vGgv/G/6PB2B/6AR2k8Yfj/58qoYkjqsKYkE4iB1LivJAKBh8a6NOfpVmpCTPapiBJHBsPz1YzqJgBRQ3WXJ1CFzg WyrjPS+w XsE+xUs8tqVuJE6+nGOccNJyOIVoN8xKJ29nHtXj/VYQIs3yMupLa2ojoXhrKrH/KflorNo/wT9xLJlTrzcoWkGgOWP57zdGbap48AxRAtiIW08k11wsKLjegNpnypzBYg8OERvFNCOVo6rQwpfvuTxziW/8bkTl753keLHQKb3E72lJ9dfo1L5/MuPgl94ZuEQ/3SESnFc0E+krUP5onyGBqZ/9ZwSj8NSSt9fyfBBa9Rp31RfEdtchhwbrvT+35rqqcQnEWEa4EgCSybkVGlO1pmQ== 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: List-Subscribe: List-Unsubscribe: On Wed, 30 Apr 2025 10:20:10 +0100 Lorenzo Stoakes wrote: > On Tue, Apr 29, 2025 at 09:22:59AM +0200, Vlastimil Babka wrote: > > On 4/28/25 17:28, Lorenzo Stoakes wrote: > > > Right now these are performed in kernel/fork.c which is odd and a violation > > > of separation of concerns, as well as preventing us from integrating this > > > and related logic into userland VMA testing going forward, and perhaps more > > > importantly - enabling us to, in a subsequent commit, make VMA > > > allocation/freeing a purely internal mm operation. > > > > I wonder if the last part is from an earlier version and now obsolete > > because there's not subsequent commit in this series and the placement of > > alloc/freeing in vma_init.c seems making those purely internal mm operations > > already? Or do you mean some further plans? > > > > Sorry, missed this! > > Andrew - could we delete the last part of this sentence so it reads: > > Right now these are performed in kernel/fork.c which is odd and a violation > of separation of concerns, as well as preventing us from integrating this > and related logic into userland VMA testing going forward. Sure. The result: : Right now these are performed in kernel/fork.c which is odd and a : violation of separation of concerns, as well as preventing us from : integrating this and related logic into userland VMA testing going : forward. : : There is a fly in the ointment - nommu - mmap.c is not compiled if : CONFIG_MMU not set, and neither is vma.c. : : To square the circle, let's add a new file - vma_init.c. This will be : compiled for both CONFIG_MMU and nommu builds, and will also form part of : the VMA userland testing. : : This allows us to de-duplicate code, while maintaining separation of : concerns and the ability for us to userland test this logic. : : Update the VMA userland tests accordingly, additionally adding a : detach_free_vma() helper function to correctly detach VMAs before freeing : them in test code, as this change was triggering the assert for this.