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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no 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 9B242C43464 for ; Thu, 17 Sep 2020 22:09:04 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 1AC7B20872 for ; Thu, 17 Sep 2020 22:09:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="iJL/T4RA" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1AC7B20872 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 715E36B0037; Thu, 17 Sep 2020 18:09:03 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6C6FD6B0055; Thu, 17 Sep 2020 18:09:03 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58DAA6B005A; Thu, 17 Sep 2020 18:09:03 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0141.hostedemail.com [216.40.44.141]) by kanga.kvack.org (Postfix) with ESMTP id 41F726B0037 for ; Thu, 17 Sep 2020 18:09:03 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 039308249980 for ; Thu, 17 Sep 2020 22:09:03 +0000 (UTC) X-FDA: 77273944566.24.snow10_3f1813327126 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin24.hostedemail.com (Postfix) with ESMTP id DDD2F1A4A0 for ; Thu, 17 Sep 2020 22:09:02 +0000 (UTC) X-HE-Tag: snow10_3f1813327126 X-Filterd-Recvd-Size: 5249 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 22:09:02 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id h6so3283357qtd.6 for ; Thu, 17 Sep 2020 15:09:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=syUESK5T5X7qlZjNL/nndaanKVVB4DAYkuwRndzHwzo=; b=iJL/T4RAiIZAU6602tCLvBP50hv5qBv76+EgdhKhRXME6zWxoQabvFaCu+1qTaoWnX AWuNC/tAT6xLQTFRqG7GZ4M/np2CMnsOU4hPsrTsOeKzME99yE4c7FIEXHm8j6k/Z9HO ZqBERjkEW0E5Po1RrftxYM25gxONpEUPbouh0DrcalJMvveyuux2MP9ll3z3L/9PBMh3 9CFiVaIUIDqrc+AMLpz4f0OIjLOYYbPtaF+jQSWCgYe6UQ+32kwW594XO6XKB7fSHFlk 66nvhPYykaBc/IXnRg5zcRaRKM/dJ4sHyZJ/3uRP6vjeRYuOJJYZ3RYtH/SdKUwwsLF+ 5UEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=syUESK5T5X7qlZjNL/nndaanKVVB4DAYkuwRndzHwzo=; b=rq79EVNv+w6ErDE4jDjOJoTZjBO1R+JOdNDPEWPGzROCHijAE5Qwic8vvnP8p7qItQ P828KC8WxUu1WC9zvymOkjcm0QjgwB+rwcFNWEHQrcqyR1xNNh7qimfbeAuq2yxv/RWy DST8DNyYjYKRTffjL/4lFPCQ9u3dc2FC0UkMdmFojhhRGXDCscVzEHzuysFC6X+m63rR f7RFF3Jm05/N4atrNT+Ox+4KwlSsh3VpXGt/F6rPhHT4u86/X4x+aIYPStOa29kBp+wk 4zvCTVG3Ippwy6KPg/ZqovstYr852dZf3SIpOMNOgDLMxVYEZz9HcFDACpfYsXCM7Qxy zKcg== X-Gm-Message-State: AOAM533j9jO/NdZs9rrokYXlNX//cMzxAjX5jLpDrmE7xe/gBDDeXeCg NE52TLnHu9rmo41cBgj0F5VDjA== X-Google-Smtp-Source: ABdhPJx/RswyKZ+BE7nlycFNmvYGJ+5hJ02F88qY2qiWW1+mgOJEaK3SuHEtv/XkJtmR/MmKNqCV+Q== X-Received: by 2002:ac8:6f21:: with SMTP id i1mr28879258qtv.89.1600380541744; Thu, 17 Sep 2020 15:09:01 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-48-30.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.48.30]) by smtp.gmail.com with ESMTPSA id b79sm825430qkg.10.2020.09.17.15.09.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 15:09:01 -0700 (PDT) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1kJ25M-000mg0-H0; Thu, 17 Sep 2020 19:09:00 -0300 Date: Thu, 17 Sep 2020 19:09:00 -0300 From: Jason Gunthorpe To: Peter Xu Cc: Linus Torvalds , John Hubbard , Leon Romanovsky , Linux-MM , Linux Kernel Mailing List , "Maya B . Gokhale" , Yang Shi , Marty Mcfadden , Kirill Shutemov , Oleg Nesterov , Jann Horn , Jan Kara , Kirill Tkhai , Andrea Arcangeli , Christoph Hellwig , Andrew Morton Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification Message-ID: <20200917220900.GO8409@ziepe.ca> References: <20200916174804.GC8409@ziepe.ca> <20200916184619.GB40154@xz-x1> <20200917112538.GD8409@ziepe.ca> <20200917181411.GA133226@xz-x1> <20200917190332.GB133226@xz-x1> <20200917200638.GM8409@ziepe.ca> <20200917214059.GA162800@xz-x1> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917214059.GA162800@xz-x1> 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, Sep 17, 2020 at 05:40:59PM -0400, Peter Xu wrote: > On Thu, Sep 17, 2020 at 01:35:56PM -0700, Linus Torvalds wrote: > > For that to happen, we'd need to have the vma flag so that we wouldn't > > have any worry about non-pinners, but as you suggested, I think even > > just a mm-wide counter - or flag - to deal with the fast-bup case is > > likely perfectly sufficient. > > Would mm_struct.pinned_vm suffice? I think that could be a good long term goal IIRC last time we dug into the locked_vm vs pinned_vm mess it didn't get fixed. There is a mix of both kinds, as you saw, and some resistance I don't clearly remember to changing it. My advice for this -rc fix is to go with a single bit in the mm_struct set on any call to pin_user_pages* Then only users using pin_user_pages and forking are the only ones who would ever do extra COW on fork. I think that is OK for -rc, this workload should be rare due to the various historical issues. Anyhow, a slow down regression is better than a it is broken regression. This can be improved into a counter later. Due to the pinned_vm accounting all call sites should have the mm_struct at unpin, but I have a feeling it will take a alot of driver patches to sort it all out. Jason