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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 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 17734C43464 for ; Thu, 17 Sep 2020 22:49:06 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 91F4D2137B for ; Thu, 17 Sep 2020 22:49:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 91F4D2137B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1F2DF6B0037; Thu, 17 Sep 2020 18:49:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1A2A26B0055; Thu, 17 Sep 2020 18:49:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 06A866B005A; Thu, 17 Sep 2020 18:49:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0003.hostedemail.com [216.40.44.3]) by kanga.kvack.org (Postfix) with ESMTP id E2D286B0037 for ; Thu, 17 Sep 2020 18:49:04 -0400 (EDT) Received: from smtpin07.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AC9B3349B for ; Thu, 17 Sep 2020 22:49:04 +0000 (UTC) X-FDA: 77274045408.07.dust27_25098ec27126 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin07.hostedemail.com (Postfix) with ESMTP id 8AB851803FFD1 for ; Thu, 17 Sep 2020 22:49:04 +0000 (UTC) X-HE-Tag: dust27_25098ec27126 X-Filterd-Recvd-Size: 4344 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by imf09.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 22:49:02 +0000 (UTC) IronPort-SDR: 3D6a4VmLvOE5rj9Ps8wGHB7Y7vTCio67czJhxhQY6x0+tkceaoEVdCweIWRNbGXRfpSb10SafI rqDMNEpHXc5w== X-IronPort-AV: E=McAfee;i="6000,8403,9747"; a="157194178" X-IronPort-AV: E=Sophos;i="5.77,272,1596524400"; d="scan'208";a="157194178" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 15:48:58 -0700 IronPort-SDR: CqwYh17Q/1F8jKVzCm2bltk11mbTsSduNQ8JbkQ/9w68yIO/U16V+vAO1goEACHYyACaA0koLy /tDsNZ9vHsHg== X-IronPort-AV: E=Sophos;i="5.77,272,1596524400"; d="scan'208";a="507920531" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 15:48:57 -0700 Date: Thu, 17 Sep 2020 15:48:57 -0700 From: Ira Weiny To: Jason Gunthorpe Cc: Peter Xu , 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: <20200917224857.GF2540965@iweiny-DESK2.sc.intel.com> References: <20200916184619.GB40154@xz-x1> <20200917112538.GD8409@ziepe.ca> <20200917181411.GA133226@xz-x1> <20200917190332.GB133226@xz-x1> <20200917200638.GM8409@ziepe.ca> <20200917214059.GA162800@xz-x1> <20200917220900.GO8409@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917220900.GO8409@ziepe.ca> User-Agent: Mutt/1.11.1 (2018-12-01) 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 07:09:00PM -0300, Jason Gunthorpe wrote: > 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. Agreed. The HFI1 driver for example increments/decrements pinned_vm on it's own. I've kind of always felt dirty for that... I think long term it would be better to move this accounting to pin_user_pages() but Jason is correct that I think that is going to be too complex for an rc. Could we move pinned_vm out of the drivers/rdma subsystem? Ira > > Jason >