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 X-Spam-Level: X-Spam-Status: No, score=-11.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1456C433DF for ; Fri, 21 Aug 2020 23:50:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0A422067C for ; Fri, 21 Aug 2020 23:50:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="jInru0sl" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0A422067C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 11A928D0079; Fri, 21 Aug 2020 19:50:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0CBF78D0008; Fri, 21 Aug 2020 19:50:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EFCE68D0079; Fri, 21 Aug 2020 19:50:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0138.hostedemail.com [216.40.44.138]) by kanga.kvack.org (Postfix) with ESMTP id D82DC8D0008 for ; Fri, 21 Aug 2020 19:50:08 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9645D180AD804 for ; Fri, 21 Aug 2020 23:50:08 +0000 (UTC) X-FDA: 77176221696.11.class98_14055fe2703d Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 53052180F8B81 for ; Fri, 21 Aug 2020 23:50:08 +0000 (UTC) X-HE-Tag: class98_14055fe2703d X-Filterd-Recvd-Size: 6429 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf38.hostedemail.com (Postfix) with ESMTP for ; Fri, 21 Aug 2020 23:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1598053805; h=from:from: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; bh=oKU2/UiF2skaQgIPLrv0bKWGr4HPLhFNCBmW53QId6s=; b=jInru0slab+sXposVbSyM8pbFr9LQQdvgSdRTzZl0dk9c9OU9VrLq9eW4Ff5uhi0rA1lUm buVUswqVmxBNtnDMYoeJxk+ie7ZcCYarf7Pbs2B3qbWMNBurBCYgDbwxHuUmwEvXvKLFkv H9t6vkYa9wkxonhiaadEQ2HGe6v92v0= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-WwLI7_4nN7KkIRz5eZmhLg-1; Fri, 21 Aug 2020 19:50:03 -0400 X-MC-Unique: WwLI7_4nN7KkIRz5eZmhLg-1 Received: by mail-qt1-f198.google.com with SMTP id r24so2457212qtu.3 for ; Fri, 21 Aug 2020 16:50:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=M/hJ2+3QuvuuDTv/txt7lwY07Jv7xqj8w65baH7PTCg=; b=Z+s9nafKWotGNuTpicYuEXivfG1CVw7EFDS/7ESVXOu5FGAB/MEYh1kwzLaGwHQtx+ 82uWsP7EFiOseJly6PT8vjbzglgGE9HgcCHEUykXxGn5jnQAw0sNk4TQDLNGmnWAK2jP 1tW/6zhDl5QNL4KfX3AflTP1NIFrIhi3Yu7QEElTXnNi3HGLrKMxH7RWe3ipUYLy83VL IBv6l/2XXWvcwISRfSjHPbdZPGBWtIPXxgteAn43kkbWCtw++Ega7qWxJeFLX9NE/Wb2 0fytQ3oeN5rr5LgsngFv6A8qpJwDOYE2ZLvyMKS6UFv1o1UCK2eirWoob3oV4zulTxxq Ehng== X-Gm-Message-State: AOAM5324RSKebt6uogU0NlU9LJH2lAc0B9iO9pUzM90Xo9DEOmm46dss Z6bGYwJtfxL8iIGBGcEMrHNY1x4eaCybP1oKWiV/a79DlsVy8tjhaDEkRcGPtQJGg/p/PCrA3iJ HLj0SSSjKFy0= X-Received: by 2002:a05:620a:1122:: with SMTP id p2mr5231551qkk.45.1598053802632; Fri, 21 Aug 2020 16:50:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyf9TcOFofVzIprDNuH38y7NKdVN1zPjbaOB0+mpCLdI95pwNyzpBVw9WbSMeBuklFfpgnsnA== X-Received: by 2002:a05:620a:1122:: with SMTP id p2mr5231526qkk.45.1598053802338; Fri, 21 Aug 2020 16:50:02 -0700 (PDT) Received: from localhost.localdomain (bras-vprn-toroon474qw-lp130-11-70-53-122-15.dsl.bell.ca. [70.53.122.15]) by smtp.gmail.com with ESMTPSA id t69sm2821600qka.73.2020.08.21.16.50.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 16:50:01 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Maya B . Gokhale" , Linus Torvalds , Yang Shi , Marty Mcfadden , peterx@redhat.com, Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Subject: [PATCH 0/4] mm: Simplfy cow handling Date: Fri, 21 Aug 2020 19:49:54 -0400 Message-Id: <20200821234958.7896-1-peterx@redhat.com> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=peterx@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 53052180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: This is a small series that I picked up from Linus's suggestion [0] to simp= lify=0D cow handling (and also more strict) by checking against page refcounts rath= er=0D than mapcounts.=0D =0D I'm CCing the author and reviewer of commit 52d1e606ee73 on ksm ("mm: reuse= =0D only-pte-mapped KSM page in do_wp_page()", 2019-03-05). Please shoot if=0D there's any reason to keep the logic, or it'll be removed in this series. = For=0D more information, please refer to [3,4].=0D =0D The new mm counter in the last patch can be seen as RFC, depending on wheth= er=0D anyone dislikes it... I used it majorly for observing the page reuses, so i= t is=0D kind of optional.=0D =0D Two tests I did:=0D =0D - Run a busy loop dirty program [1] that uses 6G of memory, restrict to 1= G=0D RAM + 5G swap (cgroup). A few hours later, all things still look good.= =0D Make sure to observe (still massive) correct page reuses using the new= =0D counter using the last patch, probably when swapping in.=0D =0D - Run umapsort [2] to make sure uffd-wp will work again after applying th= is=0D series upon master 5.9-rc1 (5.9-rc1 is broken).=0D =0D In all cases, I must confess it's quite pleased to post a series with diffs= tat=0D like this... Hopefully this won't break anyone but only to make everything= =0D better.=0D =0D Please review, thanks.=0D =0D [0] https://lore.kernel.org/lkml/CAHk-=3Dwjn90-=3Ds6MBerxTuP=3D-FVEZtR-LpoH= 9eenEQ3A-QfKTZw@mail.gmail.com=0D [1] https://github.com/xzpeter/clibs/blob/master/bsd/mig_mon/mig_mon.c=0D [2] https://github.com/LLNL/umap-apps/blob/develop/src/umapsort/umapsort.cp= p=0D [3] https://lore.kernel.org/lkml/CAHk-=3Dwh0syDtNzt9jGyHRV0r1pVX5gkdJWdenwm= vy=3Ddq0AL5mA@mail.gmail.com=0D [4] https://lore.kernel.org/lkml/CAHk-=3Dwj5Oyg0LeAxSw_vizerm=3DsLd=3DsHfcV= ecZMKPZn6kNbbXA@mail.gmail.com=0D =0D Linus Torvalds (1):=0D mm: Trial do_wp_page() simplification=0D =0D Peter Xu (3):=0D mm/ksm: Remove reuse_ksm_page()=0D mm/gup: Remove enfornced COW mechanism=0D mm: Add PGREUSE counter=0D =0D drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 8 ---=0D include/linux/ksm.h | 7 ---=0D include/linux/vm_event_item.h | 1 +=0D mm/gup.c | 40 ++------------=0D mm/huge_memory.c | 7 +--=0D mm/ksm.c | 25 ---------=0D mm/memory.c | 60 +++++++--------------=0D mm/vmstat.c | 1 +=0D 8 files changed, 29 insertions(+), 120 deletions(-)=0D =0D --=20=0D 2.26.2=0D =0D