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 E2DC7EEAA4E for ; Thu, 14 Sep 2023 15:31:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 73A2C6B02C7; Thu, 14 Sep 2023 11:31:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E9DC6B02CB; Thu, 14 Sep 2023 11:31:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D9666B02CC; Thu, 14 Sep 2023 11:31:16 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 508026B02C7 for ; Thu, 14 Sep 2023 11:31:16 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 16A5240EA9 for ; Thu, 14 Sep 2023 15:31:16 +0000 (UTC) X-FDA: 81235591752.04.EA6B412 Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by imf05.hostedemail.com (Postfix) with ESMTP id 0983E100027 for ; Thu, 14 Sep 2023 15:31:11 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=N5l2FIFY; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of surenb@google.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1694705472; 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=N5V35/NnoM0NObnhOBjIuAND7i93+ooCq17R/5R/h7s=; b=hkULKd0ZWyhAnx9jIPRT99AP2gsV1bO/F7HUH8bnvkQ3UfqLg7k8OPySmnbjSdVbE8yqGu PCvcBpxBCTbN5jZdEJyQpO0OBxNEoPBvHlcGLnikWx61BQFK5g7+qQFZMtaQK6a/NZVRys uVptF/G55+M2L9e8H9m2yNauCYQmnls= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=N5l2FIFY; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf05.hostedemail.com: domain of surenb@google.com designates 209.85.128.169 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1694705472; a=rsa-sha256; cv=none; b=P95z06PoA+oeOoNBv2yMh4mj7gf+o8REy3rFqLI+OXHEbiFroyEYwAj7fYg9UTJhaO1CdX kE4ymBFKTRRP7fSCQM1ehRAj+y4utw0rZp9hO+Uedf9xWDbnN+vKqpy0fBshohuthfHhXN APEyhyXjlvPNMBi/tLxzpzYrT6/xG4Y= Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-59bc97d7b3dso25890977b3.1 for ; Thu, 14 Sep 2023 08:31:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694705471; x=1695310271; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=N5V35/NnoM0NObnhOBjIuAND7i93+ooCq17R/5R/h7s=; b=N5l2FIFYCkckyQFSXlWoJJNc2OeWYBkLXZbqptf9i7Ik5VwqYGeLcuVvjx0kjin9aD 6jhgJsVU2LZpHVzIQHDCv0qfNvGlRf6lmy55dCuhN4utdqX+TmGGcJTWLOOPVIP5Ox6C NYrRylLR7fpKPNaFkGM3iNYeAmxryN6tpIOodR2hccWFhAwrFlX4T3lEHAiBbn9poJhI GXunzaUzowLKuvSdZoL1asVEpU1QLMdmovOglYASHSoYEKgV1qM4bDJRiGCvzsPJ6dNe CPANJP8Gfai8eyksx0CkxJudVZLNFxCLq6eBld/uu0eyyx4v4/O0UVauJwsQpHPNoT2O HUug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694705471; x=1695310271; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=N5V35/NnoM0NObnhOBjIuAND7i93+ooCq17R/5R/h7s=; b=lENKvNLWKJtp+wIeXO8z8EZ/dhLOggjGDSYJ9ktcyN1tiAZTLl1Kk6JYQN5wf7arBS ga4yKW/ZvdB/KSCZYeTHLuPgr5G5n2c7JVLHJDcqHkqNqmyZqnFUxd4/b88XKGKjaXOD uLsZha2UaWzQnuQRsP5EA49ih4q9jcxn527LgaU4Cg5dfRi9tBLz8czOROvBt0sn+e2J cBziitKC8d7v26V5O1fkLqTGouhcMvYa2mPJgCCbnKXBNAYqM0bQ/PnpkIfIf9Edy+H6 ZZQFUZrW3TS0ZWoBSV5kALN6pQEGcf2PEIyjqjBYaETu0PdnvQJ96frjgu3nyPl22gwX b5eQ== X-Gm-Message-State: AOJu0YzyUexXXAmJoDBFMcGcgUClAxNyt5C3LlPTfo47j+IIm9x5m1zF 6BpyWFvtW+psDPw3mPrAqA14Gq6ukP9cS3UPVNanaA== X-Google-Smtp-Source: AGHT+IGRNemB3RXw5lnQojxPt4q242KuMa887wtWrMqT27slM3o1JOKUjJCDcbfpyv+vd90Hh7Cf4kuU/C2z32ljems= X-Received: by 2002:a25:a2c7:0:b0:d71:6835:c250 with SMTP id c7-20020a25a2c7000000b00d716835c250mr1434596ybn.30.1694705470859; Thu, 14 Sep 2023 08:31:10 -0700 (PDT) MIME-Version: 1.0 References: <27ac2f51-e2bf-7645-7a76-0684248a5902@redhat.com> <3059388f-1604-c326-c66f-c2e0f9bb6cbf@redhat.com> <6403a950-7367-0b00-8cd5-2f0a32dac953@suse.cz> In-Reply-To: From: Suren Baghdasaryan Date: Thu, 14 Sep 2023 08:30:59 -0700 Message-ID: Subject: Re: RFC for new feature to move pages from one vma to another without split To: Lokesh Gidra Cc: Vlastimil Babka , Peter Xu , David Hildenbrand , Axel Rasmussen , Andrew Morton , "open list:MEMORY MANAGEMENT" , linux-kernel , Andrea Arcangeli , "Kirill A . Shutemov" , "Kirill A. Shutemov" , Brian Geffon , Kalesh Singh , Nicolas Geoffray , Jared Duke , android-mm , Blake Caldwell , Mike Rapoport Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 0983E100027 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: j5z6t9akzehkg6xbcjh89keg5jhrs1ce X-HE-Tag: 1694705471-833931 X-HE-Meta: U2FsdGVkX18PvlFBd/ATmPlr9QsazEdhl7r3rNOaPe5EgzDu4u5wmexJPnGMXEe3OmZCZpyvCjfMoAic37Hx3jdbPN4dCqJT81copLE/OdLfdcEGRLprHKXysc9ruEje8qEeFCfGPeJg+pa8mjUtKjNsKSyHyAI9FEpUqKEdsTr493+7AsZplrb3+hZZtjjIjSlVnCHVYAHmaL/aq4m8yvHeRt1kbVYo9oya6F95WabbL9A/Y/x9rZcB6NzzifQgS8hyAH4VPIzkV30lnxRuyYvm3dFI57HdgRriOnwEoiaZ77DlsuW8yoW2VIuEMca50kbs1SE/4NbG2cqEXdWyZJg2w64C3aqzSqZd3uqW/2ievh6ZAnunZyrFjq9tKlG78jaXTclklPlTS9SJ2zS6uq35F0XP0TkNhgPfvMXS7MWT1BhaQChApaN/r3ecSL/53A/j57G8Rv8UqA6/QrpE7eAHPigovcfNFjQ8xk0o/oUnQJ8YeRGFcny2eV0WDotgUWVMfvuyYKC4/pjumJMhUL70cRc2fH849uyEH09oyvDNgSzYha+vyh6cTxXDdBGhAd79FwmGPalXRFDsIcsT7YQmFifHJK6ZsSdhPFI5YYMLfaQTDNKUkKD2bD8A4+QLUjsKzWEAp0ron5Rpi+DfvmwjjqR2hh60TjXxqFm2rNOOF+Q5gcYTHQ0MIMdS2A5fuKfyixNGKgZDs04L96l40h7z0LEnaO20Zej77pbUGmmRVBJwyIJ9IWC0LZdaT2k+dYa7c1/MTM6QQqs/q9aO7CLKvZOwAasotKSPD1wTI++n3+xg3PORQGUdQGgmfNaQ3W4PGJEKvY+nNURar7U7dMinmECdy04jAIXt6meGDcCLJxQGe0Lg1UDV8KVt4JKxRQcwQljIyDcmzVghJVhfSrOgRiWIl1CTcOwzYS3OBGWnGil/DdNKM8G3M2aOpnyExsvsqH3ci6IWG6inUhX 6wBak3Ol iu1i2Eg4ATCT3g37xq6UBiHXY1MHokSQ+L9u6LJqTpKmyOFQb9mfBbVDU530taYft6415YDNzc4xbMKZjpg1vjXZQf6dxWwXlbZkmGSvF7unKpw8ZLw5hRO/cjjmg0OXc5iGsEADYttJbhcYaldMf7EFPzqo5PyVVwBt8QUGtjtBd92bBJFfe9Dq9ZtjQkGtyWyk4DzKf2t951sUpOuVIsXsdNAhPCfNS9r5z+gAFvpHSEyBpXJ42EzBEeTdPxWJPTaLWYmKxZCpAkuEDxMOKMz82adgLIw1tWaaXlh4jFx8SIU7/4QyMT4XAbInEFyzvwvNnQ332n8HjE8UdGO3YL2zTAaDYHQIG7QHMG2Zpfidg+8ija6ZMggQQOojI4KrKa9sAOfzfW2GpF/v0LZKjq9XWdtpm4aIZiODO1SOjcP+OwXkHfqhwB4OyioQudfRJ20Yc+NUcvaN1oy8= 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 Thu, Jun 8, 2023 at 3:05=E2=80=AFAM Lokesh Gidra wrote: > > On Tue, Jun 6, 2023 at 4:18=E2=80=AFPM Suren Baghdasaryan wrote: > > > > On Tue, Jun 6, 2023 at 1:15=E2=80=AFPM Vlastimil Babka = wrote: > > > > > > On 4/13/23 17:36, Peter Xu wrote: > > > > On Thu, Apr 13, 2023 at 10:10:44AM +0200, David Hildenbrand wrote: > > > >> So instead, we consider the whole address space as a virtual, anon= file, > > > >> starting at offset 0. The pgoff of a VMA is then simply the offset= in that > > > >> virtual file (easily computed from the start of the VMA), and VMA = merging is > > > >> just the same as for an ordinary file. > > > > > > > > Interesting point, thanks! > > > > > > FYI, I've advised a master thesis exploring how to update page->index= during > > > mremap() to keep things mergeable: > > > > > > https://dspace.cuni.cz/bitstream/handle/20.500.11956/176288/120426800= .pdf > > > > > > I think the last RFC posting was: > > > https://lore.kernel.org/all/20220516125405.1675-1-matenajakub@gmail.c= om/ > > > > > > It was really tricky for the general case. Maybe it would be more fea= sible > > > for the limited case Lokesh describes, if we could be sure the pages = that > > > are moved aren't mapped anywhere else. > > It's great that mremap is being improved for mereabilitly. However, > IIUC, it would still cause unnecessary splits and merges in the > private anonymous case. Also, mremap works with mmap_sem exclusively > held, thereby impacting scalability of concurrent mremap calls. > > IMHO, Andrea's userfaultfd REMAP patch is a better alternative as it > doesn't have these downsides. > > > > > Lokesh asked me to pick up this work and prepare patches for > > upstreaming. I'll start working on them after I finish with per-vma > > lock support for swap and userfaultd (targeting later this week). > > Thanks for all the input folks! > > Thanks so much, Suren! I just posted the patchset at https://lore.kernel.org/all/20230914152620.2743033-1-surenb@google.com/. I tried to keep it as true to Andrea's original as possible but still had to make some sizable changes, which I described in the cover letter. Feedback would be much appreciated!