Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp2524082pxb; Sun, 23 Jan 2022 07:24:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHHzmsVAQcnQdoO63UekjcJqrIlAHuuARqPesbseHsVmyaWih/ouIHCWyrxv3iDe9+4oke X-Received: by 2002:a17:903:124d:b0:149:8141:88ea with SMTP id u13-20020a170903124d00b00149814188eamr10835829plh.82.1642951451899; Sun, 23 Jan 2022 07:24:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642951451; cv=none; d=google.com; s=arc-20160816; b=uRhlOjkw6IBvr9s77wffqAXuMVdo1Rra6abpbnR2u5ite4OuyV9Zn8VrRnBIxO/VxO 1dE4/Pvsyk4FzRP4hzmbqieZTdNgaEy4hGi/z28bic1GJBPp9UHl0Yf8Lup3WpaOAbb2 orikj8OmUPlc9XqJSExJWAc59truUTX23LyOhAYPMoEyqjCmXzKM3Wq95DRE8pi2ScJH 7C+tVYw9ZnhnA7ga6HtF0jPX4IP1BRtk4ghDR30mG9k9HinTG4a/YzWwm8+P0n6ffyH3 esscp/d6gG/9UhY3ppsrmmcKLdTRe4uxKK7urdEwiqYFS7TXTHbpjqEaAp0T25eajql0 L3GA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=KVS5Vv9x4j1rYlAUHDutrpOGh/PFnNue3zM94McKQco=; b=nyQCcr/eaTLFaYAukLib/QQuxWnJJClDKdxaQnlxYL30vBqc8JvTQ8llMI4yKBDAT4 gzrwxeANsMWKxwzyKmF/F60F+vWjRodGC8q9asIPtt7ySjk0HfcpWG8OOWyzybbFTsoR 8bf7Js/st9pLJ/W/o9roOB7m6KwCNrlWVsP3dXetOucWL41ILyXnNVTJc440OooohM8K sqBqSYXLMeLI7nG68gE5881TTVDK31V9Re9p+38wPBy6/b1qBTzQWCyuf9BAVjZsJVUy q6vqGi4pbqjDvilzODTmR/gJdU3z0seqqAC6Kf3oTbu8AiduUQQUmXS9wDSWBnfsFZFx KsLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amacapital-net.20210112.gappssmtp.com header.s=20210112 header.b=kholFSU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o10si5460896pjt.140.2022.01.23.07.23.59; Sun, 23 Jan 2022 07:24:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amacapital-net.20210112.gappssmtp.com header.s=20210112 header.b=kholFSU9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234678AbiAVSaB (ORCPT + 99 others); Sat, 22 Jan 2022 13:30:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47444 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231531AbiAVSaA (ORCPT ); Sat, 22 Jan 2022 13:30:00 -0500 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E214C06173B for ; Sat, 22 Jan 2022 10:30:00 -0800 (PST) Received: by mail-ed1-x531.google.com with SMTP id b13so48785563edn.0 for ; Sat, 22 Jan 2022 10:30:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amacapital-net.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=KVS5Vv9x4j1rYlAUHDutrpOGh/PFnNue3zM94McKQco=; b=kholFSU9WGDaL/0mgovS14dARJabt548SLamMinuPddwYwVdJRCCSLmO1TwfadRZO9 bCI30s7DEqnwPVnSZuYXuGZpAuitnKfYNWxbnL5Dj7z4yzh90gbmjba5aIVJATxhhxnF A7PhNMSYUKRTgnpG/XnU1Lk/mFqyftkzWynXnr/2DeKMXGm0vbqk1aX9GeXl9A7n1TMs zK0Y9t7dE3jNTo4QIp3lkW4nOz+ckYfbzbf9XDbcbVChm/yuKhFg6WZY/V2djeS05Qv+ X3coRp0gpFQMiKaH4Nm1bjM8dRmmq2JbaivIhBdZPkCU4fIobe62NABBKHuux9jRjqlI s7Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=KVS5Vv9x4j1rYlAUHDutrpOGh/PFnNue3zM94McKQco=; b=mKqUMoX5bOqIzwu8edrDOKWXXGKD0wHRzaIV1+JpOQvoDsaONnWbW/dJ1W4lXDpX1v jIXVOHQUBLQzF2C14KMwITBpUEeDAGCMl/anJW4Vdw2axX8dl1Feq9twoqF0TvXteRbR ozIwQPvdu/AgLcBuifp5L2nZS2SJER5gS3o8kNuz3W/CQywOgrCHSIbw17aILteS7aRl MyMTfbBAQW7djaQ3RkD/BTkaSnd+w4MRJ/Ppj4pffaGelgE5fEu192xUbk4w/livWDL7 JpFNPZU2N3Y7+MXx/t9YRqloR9iTe+S0P3HsEcP/pmq/XnGRzMKuAuGHF/4Q9kAscMwJ hiZg== X-Gm-Message-State: AOAM533DB9oA0ma9eWSUCE9GBu1xdCPeWgVYRz0F0mVzXdN5FL5Nm5Oy 8kfDM/PG/vwUzylYFyJz4yjMwmkmZ+zB0i+YYhnlGA== X-Received: by 2002:a50:d709:: with SMTP id t9mr400764edi.50.1642876198379; Sat, 22 Jan 2022 10:29:58 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Andy Lutomirski Date: Sat, 22 Jan 2022 10:29:36 -0800 Message-ID: Subject: Re: [RFC PATCH 0/6] Add support for shared PTEs across processes To: Mike Rapoport Cc: Khalid Aziz , akpm@linux-foundation.org, willy@infradead.org, longpeng2@huawei.com, arnd@arndb.de, dave.hansen@linux.intel.com, david@redhat.com, surenb@google.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-api@vger.kernel.org, Andy Lutomirski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jan 22, 2022, at 3:31 AM, Mike Rapoport wrote: > > =EF=BB=BF(added linux-api) > >> On Tue, Jan 18, 2022 at 02:19:12PM -0700, Khalid Aziz wrote: >> Page tables in kernel consume some of the memory and as long as >> number of mappings being maintained is small enough, this space >> consumed by page tables is not objectionable. When very few memory >> pages are shared between processes, the number of page table entries >> (PTEs) to maintain is mostly constrained by the number of pages of >> memory on the system. As the number of shared pages and the number >> of times pages are shared goes up, amount of memory consumed by page >> tables starts to become significant. Sharing PTEs is nice, but merely sharing a chunk of address space regardless of optimizations is nontrivial. It=E2=80=99s also quite useful, potentially. So I think a good way to start would be to make a nice design for just sharing address space and then, on top of it, figure out how to share page tables. See here for an earlier proposal: https://lore.kernel.org/all/CALCETrUSUp_7svg8EHNTk3nQ0x9sdzMCU=3Dh8G-Sy6=3D= SODq5GHg@mail.gmail.com/ Alternatively, one could try to optimize memfd so that large similarly aligned mappings in different processes could share page tables. Any of the above will require some interesting thought as to whether TLB shootdowns are managed by the core rmap code or by mmu notifiers.