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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1BA5ACC6B0E for ; Tue, 13 Oct 2026 16:07:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0E8C36B0088; Tue, 13 Oct 2026 12:07:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 09A506B008A; Tue, 13 Oct 2026 12:07:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECAA86B008C; Tue, 13 Oct 2026 12:07:00 -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 BCE896B0088 for ; Tue, 13 Oct 2026 12:07:00 -0400 (EDT) Received: from smtpin11.hostedemail.com (lb01a-stub [10.200.18.249]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4F9B280D17 for ; Tue, 13 Oct 2026 16:07:00 +0000 (UTC) X-FDA: 85318081800.11.A000E69 Received: from pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com (pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com [44.246.77.92]) by imf15.hostedemail.com (Postfix) with ESMTP id E351EA0006 for ; Tue, 13 Oct 2026 16:06:57 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazoncorp2 header.b=ruIeTRbO; spf=pass (imf15.hostedemail.com: domain of "prvs=739a28f01=itazur@amazon.co.uk" designates 44.246.77.92 as permitted sender) smtp.mailfrom="prvs=739a28f01=itazur@amazon.co.uk"; dmarc=pass (policy=quarantine) header.from=amazon.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1791907618; 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=5RGsatsPAyQIBEtdraUseJGGZDIDfWt4LgToyJkkY0g=; b=CxLBCox2AwS9KSWirb6W0IRmClcptTmiBWErztS3rXEJdSAyeYxKlEEhScTRZaRLeoUhcX ATQZHArV54eO5bnK388scMRohUI9pQs3u4QTLjTiskdQp7axHWKpvp687q2p1PrtBExW+m dWkisoAXZMBc1vuwHJUKgs9rGk/0Cmg= ARC-Seal: i=1; a=rsa-sha256; d=hostedemail.com; s=arc-20220608; cv=none; t=1791907618; b=5SFBKHEsA3SlH7bePft/jaAGtgU05Ul6i216sXlA84Fb2aQpgM7NQCnwOVrmIAFIffpINI r+WJE/3c3PF1Q3Cr2ypbieL2qH+GH3ZAk56783QcprWdYFI5PnWm3omlM4QZO5NiGlDjdD GIbT/ny7K21DqmqjAkhMVi10Cw8bW20= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=amazon.com header.s=amazoncorp2 header.b=ruIeTRbO; spf=pass (imf15.hostedemail.com: domain of "prvs=739a28f01=itazur@amazon.co.uk" designates 44.246.77.92 as permitted sender) smtp.mailfrom="prvs=739a28f01=itazur@amazon.co.uk"; dmarc=pass (policy=quarantine) header.from=amazon.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazoncorp2; t=1791907618; x=1823443618; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=5RGsatsPAyQIBEtdraUseJGGZDIDfWt4LgToyJkkY0g=; b=ruIeTRbOkK656ethvMJQ7Mm7CtxnPk/VLs0ywFMWnYd9OkVaQ6PceKOb onBXHkvztNg+BrBYgribp6+8hKLk/Y3VyZUA0G9G2HSM3X9hs3iMjV6ec Ftk42+7swHdFNS4xoM5S5zBsUhTxPWMiBaGqE2vw1ZgemEsQi/lyG2PeZ 7euWcOqXF4Xg0cxyRfzAam8xueS0XvyY0cNwA57q+yUoPcX3quxpoi17w EtLduMESBgmOv15Wdyra4tN3xFqJ5+6wh9nWy+HZvcLk7XjEn9SrzXEqm c145pubLhgYhfh7owEUxzPRTh3XDySw+ccN/XQB94UWg3WqRytgFR6QYZ A==; X-CSE-ConnectionGUID: EzT8FQ1qRkitCh9eAqylmQ== X-CSE-MsgGUID: 0N5fJEVHQK2EpK1JLFPKKQ== X-IronPort-AV: E=Sophos;i="6.27,156,1787011200"; d="scan'208";a="31138648" Received: from ip-10-5-9-48.us-west-2.compute.internal (HELO smtpout.naws.us-west-2.prod.farcaster.email.amazon.dev) ([10.5.9.48]) by internal-pdx-out-004.esa.us-west-2.outbound.mail-perimeter.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Oct 2026 16:06:53 +0000 Received: from EX19MTAUWB001.ant.amazon.com [205.251.233.104:15933] by smtpin.naws.us-west-2.prod.farcaster.email.amazon.dev [10.0.25.46:2525] with esmtp (Farcaster) id 95bf7a0b-1374-49ed-916d-f238717f74ff; Tue, 13 Oct 2026 16:06:53 +0000 (UTC) X-Farcaster-Flow-ID: 95bf7a0b-1374-49ed-916d-f238717f74ff Received: from EX19D001UWA001.ant.amazon.com (10.13.138.214) by EX19MTAUWB001.ant.amazon.com (10.250.64.248) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.49; Tue, 13 Oct 2026 16:06:53 +0000 Received: from b0f1d8753182.ant.amazon.com (10.106.82.29) by EX19D001UWA001.ant.amazon.com (10.13.138.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA) id 15.2.2562.53; Tue, 13 Oct 2026 16:06:47 +0000 From: Takahiro Itazuri To: Yosry Ahmed CC: Sean Christopherson , Brendan Jackman , Borislav Petkov , Dave Hansen , Peter Zijlstra , "Andrew Morton" , David Hildenbrand , Vlastimil Babka , Mike Rapoport , Wei Xu , Johannes Weiner , Zi Yan , Lorenzo Stoakes , , , , Sumit Garg , Will Deacon , , Roy Patrick , Andy Lutomirski , David Kaplan , Thomas Gleixner , Patrick Bellasi , Reiji Watanabe , Nikita Kalyazin , "Ackerley Tng" , Takahiro Itazuri , , Kevin Brodsky , "Gregory Price" , , Derek Manwaring Subject: Re: [PATCH v3 03/26] mm: introduce AS_NO_DIRECT_MAP Date: Tue, 13 Oct 2026 17:05:58 +0100 Message-ID: <20261013160557.54828-2-itazur@amazon.com> X-Mailer: git-send-email 2.43.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain X-Originating-IP: [10.106.82.29] X-ClientProxiedBy: EX19D031UWA002.ant.amazon.com (10.13.139.96) To EX19D001UWA001.ant.amazon.com (10.13.138.214) X-Rspamd-Queue-Id: E351EA0006 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: rj9qu3s3oog1ic9s1g3modu4d75h71it X-HE-Tag: 1791907617-869100 X-HE-Meta: U2FsdGVkX18FXlkYFROj9pfXlbfdagTfnI/Ce/KpP5/hdMBqauFNKj/zXzQ6j7X7Fj74Z3VUZ3F7gytmovqUIX2hmXfXE377i4JjK1RYMhnY+DaRrO9tmQjl99bmgE3EtJkgpxWfO05LznxoONycXCGZJq0Wfa3CNB0DKCTh19NH/sVdoETsLNX1ht515UVu0RUA31cbDGmAZCTBCwiedJNWfQE1WLU3rJfAt7MkBP+uzPaj2+TmhEeZK+FyBtug/OxXwooiRcijV9P89e8tz4klXKtu2GCxGEtJqqO2OvOirpBlpQVZGcbeY+5TJ3pGs+upRHotBcHtZOUKXmDKwjFFV/gjemqjCm1xYh2N0LcVOaT13I9Dg+IvfDXpXCNbqoVZiRkk3ftawZOihAM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bJRJKbIJedztnXI+UV7bReokseHEEg1ebnHs1ewUDmpyQ/YzD+TvFqLnHh9lNUGoGGqDT7id74HN7mPlv4ca0AgPS6jcnB8Koqs+F6zvgZewsLSMU69/tzNAwJSWTILGq5/SENJWHz6vTst8BPLJdiUV3vIa6wXRQjtJa2o8o2O9W5lM8HWELk4i4/WZlvOsnMc759CtuLLQB7rB5Cp9DcOAVyG6fXofMnByFonmU1Ec3sG4THGEY/teY0LXM Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Tue, 13 Oct 2026 08:36:54 -0700, Yosry Ahmed wrote: > > 3. ALLOC_UNMAPPED and the mermap > > > > AS_NO_DIRECT_MAP itself works without them, by zapping the direct map > > of each folio. However, guest_memfd will eventually need a temporary > > kernel mapping to populate guest memory via write() [2], because > > folios are already unmapped once they are added to the page cache. [...] > > FWIW, I think the mermap can still be used without ALLOC_UNMAPPED, and > I did have a newer version of the x86 patches repurposing the LDT area > for the mermap, and simplifying the mermap implementation a bit. I can > share them privately if you want to take a look. Yes please, that would be very helpful. Thanks! Agreed that the mermap can be used without ALLOC_UNMAPPED. To give a bit more context from the guest_memfd side: I can't say anything definite until I've gone through the use cases, but as far as I can see now, guest_memfd needs the mermap only for write() support. write() is an optimization for populating guest memory (e.g. when restoring a snapshot) and isn't functionally required, because userspace can also populate guest memory through its own mapping of guest_memfd. So I currently plan to keep write() support, and with it the mermap, out of the guest_memfd direct map removal series itself. Since ALLOC_UNMAPPED is the main user of the mermap, it may make more sense for the two to land together later. One thing I'd like to look into is arm64. Firecracker also runs on arm64, so write() needs to work there too, but the mermap currently relies on the x86 mm-local region, and it sounds like your newer version relies on the LDT area. Kevin, do you happen to have any ideas on how something similar could be done on arm64? Thanks, Takahiro