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=-10.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable 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 9AC1BC43465 for ; Fri, 18 Sep 2020 21:06:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E03EA221EC for ; Fri, 18 Sep 2020 21:06:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nvidia.com header.i=@nvidia.com header.b="iDmZKip4" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E03EA221EC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nvidia.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 536E16B0093; Fri, 18 Sep 2020 17:06:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4E6E16B0095; Fri, 18 Sep 2020 17:06:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3D6946B0096; Fri, 18 Sep 2020 17:06:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 26ADF6B0093 for ; Fri, 18 Sep 2020 17:06:27 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id DD3BF8249980 for ; Fri, 18 Sep 2020 21:06:26 +0000 (UTC) X-FDA: 77277415572.06.lunch33_020023e2712e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id AF068100D721E for ; Fri, 18 Sep 2020 21:06:26 +0000 (UTC) X-HE-Tag: lunch33_020023e2712e X-Filterd-Recvd-Size: 4801 Received: from hqnvemgate26.nvidia.com (hqnvemgate26.nvidia.com [216.228.121.65]) by imf26.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Sep 2020 21:06:25 +0000 (UTC) Received: from hqmail.nvidia.com (Not Verified[216.228.121.13]) by hqnvemgate26.nvidia.com (using TLS: TLSv1.2, AES256-SHA) id ; Fri, 18 Sep 2020 14:06:12 -0700 Received: from [10.2.52.182] (172.20.13.39) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Fri, 18 Sep 2020 21:06:23 +0000 Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification To: Peter Xu , Jason Gunthorpe CC: Linus Torvalds , 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 References: <20200915232238.GO1221970@ziepe.ca> <20200916174804.GC8409@ziepe.ca> <20200916184619.GB40154@xz-x1> <20200917112538.GD8409@ziepe.ca> <20200917193824.GL8409@ziepe.ca> <20200918164032.GA5962@xz-x1> <20200918173240.GY8409@ziepe.ca> <20200918204048.GC5962@xz-x1> From: John Hubbard Message-ID: <0af8c77e-ff60-cada-7d22-c7cfcf859b19@nvidia.com> Date: Fri, 18 Sep 2020 14:06:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <20200918204048.GC5962@xz-x1> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.13) To HQMAIL107.nvidia.com (172.20.187.13) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1600463172; bh=EeYfA5vQuzdloR5edxzjymDs6wbsfA1RfZq/g/2zM0E=; h=Subject:To:CC:References:From:Message-ID:Date:User-Agent: MIME-Version:In-Reply-To:Content-Type:Content-Language: Content-Transfer-Encoding:X-Originating-IP:X-ClientProxiedBy; b=iDmZKip4T8DFhdtzdKAJCCQt7lVpKLnha4ua/0z62dcmNcgryyBs5ZCUp96AOOHzx dIb9rBEiZD6pinrehYKdbKlxbRVJ8nfG9rD2pCy4CxxTB5CHLarS/Q1Q/qQh1NSCIZ j9WYBC/3vg2HKlUvcbnsFJSRWf8G5vjQvxPZLEInuHeg3RdQbNwrLdOshUGn/ajgai Qr9b0lM0aTl/wRUr5jAjs0pMbNOwn6aKpZz2SdnuecHINaHX1+GEg4elEXad5moCBb EJszH0hOYcn3oHpF9PBshmFo07VoEAShacH6jHL2N4erLc9BhfozBAdsY100ACrdRz fzSHOaKH5fc2w== 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 9/18/20 1:40 PM, Peter Xu wrote: > On Fri, Sep 18, 2020 at 02:32:40PM -0300, Jason Gunthorpe wrote: >> On Fri, Sep 18, 2020 at 12:40:32PM -0400, Peter Xu wrote: >> >>> Firstly in the draft patch mm->has_pinned is introduced and it's written to 1 >>> as long as FOLL_GUP is called once. It's never reset after set. >> >> Worth thinking about also adding FOLL_LONGTERM here, at last as long >> as it is not a counter. That further limits the impact. > > But theoritically we should also trigger COW here for pages even with PIN && > !LONGTERM, am I right? Assuming that FOLL_PIN is already a corner case. > This note, plus Linus' comment about "I'm a normal process, I've never done any special rdma page pinning", has me a little worried. Because page_maybe_dma_pinned() is counting both short- and long-term pins, actually. And that includes O_DIRECT callers. O_DIRECT pins are short-term, and RDMA systems are long-term (and should be setting FOLL_LONGTERM). But there's no way right now to discern between them, once the initial pin_user_pages*() call is complete. All we can do today is to count the number of FOLL_PIN calls, not the number of FOLL_PIN | FOLL_LONGTERM calls. The reason it's that way, is that writeback and such can experience problems regardless of the duration of the pin. There are ideas about how to deal with the pins, and the filesystem (layout leases...) but still disagreement, which is why there's basically no page_maybe_dma_pinned() callers yet. Although I think we're getting closer to using it. There was a recent attempt at using this stuff, from Chris Wilson. [1] [1] https://lore.kernel.org/intel-gfx/20200624191417.16735-1-chris%40chris-wilson.co.uk/ thanks, -- John Hubbard NVIDIA