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 41623C433FE for ; Sat, 22 Jan 2022 18:30:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4793F6B0096; Sat, 22 Jan 2022 13:30:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4294C6B0099; Sat, 22 Jan 2022 13:30:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 317F66B009A; Sat, 22 Jan 2022 13:30:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0219.hostedemail.com [216.40.44.219]) by kanga.kvack.org (Postfix) with ESMTP id 1E6E76B0096 for ; Sat, 22 Jan 2022 13:30:01 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id D4A92181CA0B7 for ; Sat, 22 Jan 2022 18:30:00 +0000 (UTC) X-FDA: 79058762160.22.3C59F0F Received: from mail-ed1-f53.google.com (mail-ed1-f53.google.com [209.85.208.53]) by imf28.hostedemail.com (Postfix) with ESMTP id 92BD7C0008 for ; Sat, 22 Jan 2022 18:29:59 +0000 (UTC) Received: by mail-ed1-f53.google.com with SMTP id r10so17554415edt.1 for ; Sat, 22 Jan 2022 10:29:59 -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=6RFiPoadocLwGa7wiwsE+zqqZA2Bx2nViLef5Km/n764jENQlVAm59h9AHqqOiXvga FjxQjdEYFu+zkyRW3oTfj5ZyCmLNFbJbjqIQoGfEMoWBMZNLdvTQmacsrm+PAUXi+h+o qSXqeY9t2OXGbDH2M18Fxe7HoB3rfyKnX5Sp52qWadq+7Yawc0DzEokFVS2rq6hf/32K 3xe4Qa6jH2kJWa+CFoRdUYyvw9lcv1opng7DsQu+5+0lmF9lEPs0dBYQ8BLnNEtgD2lU QSyvM+Z5AVSieBbL+2Bp7eMSVNZRpHhDd0xIFh553OrAaDVT5zT42KoDQgqHexBjCaEE Nauw== X-Gm-Message-State: AOAM531YbMTyOhblYsKwlYQGML31hhYQyuRL8OfAAMGXWclom0Thf7Kd E5mCCvjvqhCtwrLvRG1U7AbvjZxgaSQBTsbVRuBFdQ== X-Google-Smtp-Source: ABdhPJxRjsZwdzd5a5cG5hKLAE10zuNJrJIajhUwS3LhZ6WtAz8ve8XMfwHxy+cTCfuabmxgnkTfSZtlmJvuMGOFu6w= 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 X-Stat-Signature: 18ddfib1ecemzb991cazun7ewnsp4ue6 Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=amacapital-net.20210112.gappssmtp.com header.s=20210112 header.b=kholFSU9; dmarc=none; spf=pass (imf28.hostedemail.com: domain of luto@amacapital.net designates 209.85.208.53 as permitted sender) smtp.mailfrom=luto@amacapital.net X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 92BD7C0008 X-HE-Tag: 1642876199-514252 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: > 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.