Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp761147pxk; Thu, 17 Sep 2020 15:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzgpYlVAWRQQyiT4JuDnLarc9AStqe0FD5Alz/iGxKKIOuGTYcaH8Jz86uDdIGS5S1Nqvbs X-Received: by 2002:aa7:cd85:: with SMTP id x5mr6434243edv.0.1600383180621; Thu, 17 Sep 2020 15:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600383180; cv=none; d=google.com; s=arc-20160816; b=YgKYtn4VKosEaiy0jMR03uLTBrSJlSjw1WuhWvLCic50oQVqGxTIYGXlVAf3+B0Yjo Btc8gnya91IRKad12bqgjg/WwtfI+83LSvPi2R0NyTjW3D3OKJvmAhK81kyhAmOVgTtx /co/bY549mnNFDQ/EnxIKfms2GEMVdQJTewMdLyI4ZjCJCHBSX596CcrA7O14cqhhDz5 w6RMBvRbjpJlNlxkl2zJHildyQoco6Cirvo5JJ7mX4ZjkcqYqNco79EWV5LsXSz8vr7y w18rOZrpL4FViUmrD4E7jn6knEIL+3+gONJ0VG0zYv9ts0Z6ih0Y51L9KFM8WcVBvGJW hePg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=T6In7ApcHE93xxxzu4PFeVjZFb3z7zuoF3vjEEtazfI=; b=I9YGCua2Df0YUymLjLUu1sw5WNr5DSw3CnaG0oYNlyXzRCHJBqnzaOk0PDALvNH8l4 z/btx4dIyEt1DJW7Mmj2ZJfv4WB2oCitmFYWz8NVW771AQpnmP+yV11K3Jz+PUlqWfim EijCY1oCLJxa5UAee/8IzxNyw3p4Ze2X7lcnJKhhh+AUaDL8X++ZaKk4xZRZ4/OMBUQ1 TGuDyS7nXHFoZJo+BmMcp5PiJt0gudrluFVet4mO7PttM5XP4oRR62aXrP3BTrUW4V2S 0CZy6v2NAfMAI6BUFYqyIU6NDFRWC7KW+tk7S/bBJy3ICQANsaZyuLqAoUYUWGqz3Fti jydQ== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j23si875405ejm.736.2020.09.17.15.52.37; Thu, 17 Sep 2020 15:53:00 -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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726327AbgIQWtD (ORCPT + 99 others); Thu, 17 Sep 2020 18:49:03 -0400 Received: from mga12.intel.com ([192.55.52.136]:15217 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725858AbgIQWtD (ORCPT ); Thu, 17 Sep 2020 18:49:03 -0400 IronPort-SDR: fTTBK0nT3ZT8Ol3hmpZ4b28YZ7AzajTHPZ+vooj94cq9fBkqyCJxA32Y/s8LlbhTPEbbfxXXl0 GJMeWDIeh4mQ== X-IronPort-AV: E=McAfee;i="6000,8403,9747"; a="139312774" X-IronPort-AV: E=Sophos;i="5.77,272,1596524400"; d="scan'208";a="139312774" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga106.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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >