Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1991404pxa; Mon, 24 Aug 2020 01:42:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwo/1yrSG5j6dc7PRWFhsmgPxL1rASEeFGeWq6Bvuyo3qTPy2w0YvUAqkXLS3fEu6ntpUF8 X-Received: by 2002:a17:906:b286:: with SMTP id q6mr4275314ejz.99.1598258529083; Mon, 24 Aug 2020 01:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598258529; cv=none; d=google.com; s=arc-20160816; b=fKxcr16LgkGPrjIPxf3LDzOGm2qtb5sMwdUNApmDHeruq/Tlkgv1NzLKxuxNkrl9PQ ZO3B5+mkqIjdzol3rgBDLwwQ47JDAGFWWJFYwCp6D7SErpu2jhdlIDMuto4PLJsLhPxx XB7Kgqv4qqb8wP2CJFcH0nuBBTfQRRI9dwieO7k6jV1ZHgeOm/pswhyBerB7vBWWdvxk ZHrHE7teCjZoqS5nlGewQ/oA+01H7hKTBWpS1slZvbLfzszWX1nrL8ib6qfGuSa4NTNt ZALi6K7ZkKhivw4t6/H8h0zQdlEvSvjdACNuY+3Zu11yxLXYwU/Ln9TTZaxSAZUAKyNI Jl+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=vn4LE0ZoHOEX99d6nikMqekV+6ciEsI8Ru3c4dchnoA=; b=dFaX5n8+eNhFtxmRBn4zRXxz8B9KaWyLMaXIFSJ22reer0pyHhyG1xV2FKADrHwM1B GZiYyIRobyidn0xkimWLKSWXFil/CGQxiadaxeVNNjwU3uHSsepx6uQyrxfH9ZY+Il5z rNTZLaNime0bhIkl3Viyk1CQHdsIg1E40MCcX5CHUratAOegiD1kjOhp/m31fpB25wVb RrD/MyyDGB4hLkhwteKMFGBibLVKToCz0EAk3bS8Jc4yMHefAln/SuNkgTFITsDHC5Pb 7qtu6ZuYSHVUF9dyhkLpqIUaWYANoYXtgFoMH5zIG+j5klrO8ySp+bGfB2jhgbgHAttv Xmmg== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si6287396edq.543.2020.08.24.01.41.46; Mon, 24 Aug 2020 01:42:09 -0700 (PDT) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=virtuozzo.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728595AbgHXIjE (ORCPT + 99 others); Mon, 24 Aug 2020 04:39:04 -0400 Received: from relay.sw.ru ([185.231.240.75]:58058 "EHLO relay3.sw.ru" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726825AbgHXIjD (ORCPT ); Mon, 24 Aug 2020 04:39:03 -0400 Received: from [192.168.15.190] by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kA7zr-000xMS-Oh; Mon, 24 Aug 2020 11:38:31 +0300 Subject: Re: [PATCH 0/4] mm: Simplfy cow handling To: Peter Xu , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Maya B . Gokhale" , Linus Torvalds , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Andrea Arcangeli , Christoph Hellwig , Andrew Morton References: <20200821234958.7896-1-peterx@redhat.com> From: Kirill Tkhai Message-ID: <6ebc0bfa-5afe-1114-876e-39e89143eb6d@virtuozzo.com> Date: Mon, 24 Aug 2020 11:38:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200821234958.7896-1-peterx@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22.08.2020 02:49, Peter Xu wrote: > This is a small series that I picked up from Linus's suggestion [0] to simplify > cow handling (and also more strict) by checking against page refcounts rather > than mapcounts. > > I'm CCing the author and reviewer of commit 52d1e606ee73 on ksm ("mm: reuse > only-pte-mapped KSM page in do_wp_page()", 2019-03-05). Please shoot if > there's any reason to keep the logic, or it'll be removed in this series. For > more information, please refer to [3,4]. I'm not sure I understand the reasons to remove that. But the reason to add was to avoid excess page copying, when it is not needed in real. > The new mm counter in the last patch can be seen as RFC, depending on whether > anyone dislikes it... I used it majorly for observing the page reuses, so it is > kind of optional. > > Two tests I did: > > - Run a busy loop dirty program [1] that uses 6G of memory, restrict to 1G > RAM + 5G swap (cgroup). A few hours later, all things still look good. > Make sure to observe (still massive) correct page reuses using the new > counter using the last patch, probably when swapping in. > > - Run umapsort [2] to make sure uffd-wp will work again after applying this > series upon master 5.9-rc1 (5.9-rc1 is broken). > > In all cases, I must confess it's quite pleased to post a series with diffstat > like this... Hopefully this won't break anyone but only to make everything > better. > > Please review, thanks. > > [0] https://lore.kernel.org/lkml/CAHk-=wjn90-=s6MBerxTuP=-FVEZtR-LpoH9eenEQ3A-QfKTZw@mail.gmail.com > [1] https://github.com/xzpeter/clibs/blob/master/bsd/mig_mon/mig_mon.c > [2] https://github.com/LLNL/umap-apps/blob/develop/src/umapsort/umapsort.cpp > [3] https://lore.kernel.org/lkml/CAHk-=wh0syDtNzt9jGyHRV0r1pVX5gkdJWdenwmvy=dq0AL5mA@mail.gmail.com > [4] https://lore.kernel.org/lkml/CAHk-=wj5Oyg0LeAxSw_vizerm=sLd=sHfcVecZMKPZn6kNbbXA@mail.gmail.com > > Linus Torvalds (1): > mm: Trial do_wp_page() simplification > > Peter Xu (3): > mm/ksm: Remove reuse_ksm_page() > mm/gup: Remove enfornced COW mechanism > mm: Add PGREUSE counter > > drivers/gpu/drm/i915/gem/i915_gem_userptr.c | 8 --- > include/linux/ksm.h | 7 --- > include/linux/vm_event_item.h | 1 + > mm/gup.c | 40 ++------------ > mm/huge_memory.c | 7 +-- > mm/ksm.c | 25 --------- > mm/memory.c | 60 +++++++-------------- > mm/vmstat.c | 1 + > 8 files changed, 29 insertions(+), 120 deletions(-) >