Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1646979imm; Sat, 13 Oct 2018 00:35:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV61hFOpaEbkliZpOIRCIvHKG1rZN1gmJWHTeYNPOOrnKqlWcopG/NkmOreyR8YSumAcl4zMh X-Received: by 2002:a17:902:3341:: with SMTP id a59-v6mr8966385plc.138.1539416113275; Sat, 13 Oct 2018 00:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539416113; cv=none; d=google.com; s=arc-20160816; b=Rv5Qw3DXZ/J3awtun+/nYrLgvAD3nE6APmb4+Ul5mOfDCi2saIF9dwNeUJrPnB2Yr9 3Dy4vbhdtSqVCsb5fVHpBEErrM+U1vBt81ZTOLKYqtDTs4LGxGQ6gNgvgcE0lR5V60lk 7hf7QsbgR57Cmes9QnGu9zlterjb3lKP8rOaTXlVW22fofUbpRDo8u9TLZm+ujDuZhkO /QfI7zfbqNNaiKiQqVotllshGtOo/rcMi02A+03y4W/hR00hrKISot+Wi730rHV3EJvu caJX1v8NCe7A7nmyIPBWZAHXHKvjTZlYeKNARa0cX+uJtxXJ2bPDjjgd/lOaKrxG1Sx7 CnCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=/bb3AMg9e+Djf3tibPaDqqvLS5l6tMhsKXMx7F1n/D8=; b=SB/F0P0cQujiql5djhZDSK3r9LxOxHgzQxn1L4xZV9QEfZmnHo37c7xA2oaKBB5zvh 4YE0cCBZvF1FH7Th5MO80wANV7Q7ALtdjlUdavs7IDhYgVXOYbBYTtAF/fpvI2fBCD4e 9b6NCd5E9Q7U9SWv7dqL1DjlpzKclTQIG8b2U7nHsy/2l0Om+eVf2G15QIgHANNogWfE axH3KxiEVtMSPHYpvC0J7kB1yyZby32Z2Hkyq9ATzqKsRmAWWlCrVaclIfYXL3JkanJe Z26SLnXlfDUC11KlPh1UWjjjuBL4QS3aRoKmjYaNXPASfUtyVH1fPwItzeQEZGKrRnJ9 IJqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=G3BOcRXq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c68-v6si3948114pfa.45.2018.10.13.00.34.58; Sat, 13 Oct 2018 00:35:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=G3BOcRXq; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726869AbeJMPKT (ORCPT + 99 others); Sat, 13 Oct 2018 11:10:19 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:2088 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725986AbeJMPKT (ORCPT ); Sat, 13 Oct 2018 11:10:19 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Sat, 13 Oct 2018 00:34:07 -0700 Received: from HQMAIL101.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Sat, 13 Oct 2018 00:34:13 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Sat, 13 Oct 2018 00:34:13 -0700 Received: from [10.2.167.215] (172.20.13.39) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 13 Oct 2018 07:34:13 +0000 Subject: Re: [PATCH 4/6] mm: introduce page->dma_pinned_flags, _count To: Dave Chinner CC: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Jan Kara , , Andrew Morton , LKML , linux-rdma , References: <20181012060014.10242-1-jhubbard@nvidia.com> <20181012060014.10242-5-jhubbard@nvidia.com> <20181013035516.GA18822@dastard> X-Nvconfidentiality: public From: John Hubbard Message-ID: <7c2e3b54-0b1d-6726-a508-804ef8620cfd@nvidia.com> Date: Sat, 13 Oct 2018 00:34:12 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: <20181013035516.GA18822@dastard> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL106.nvidia.com (172.18.146.12) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1539416047; bh=/bb3AMg9e+Djf3tibPaDqqvLS5l6tMhsKXMx7F1n/D8=; h=X-PGP-Universal:Subject:To:CC:References:X-Nvconfidentiality:From: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=G3BOcRXqIHOxdV3aC94mYdSric4FDyeDquG+nvFTPLRePE1xH5NYgiDLHu6Z5BYjy EAl5D8KaRrDQj09MqrAySppBtlMZ6O5l+YN1Hp70b7GpFvox4zzrhJqblEonr+bFa8 59LBlXiAyuYBYul9KcHN381GUGk+qwQMX8DH3Wr76EqCQn5PSiHIk3VFyXB+lllHiP 9lYKDeSzBEU7IHMolGkxM5p6T/XqW16gZfVLKALuGS3m7VaVc1r8GXnovunCnXBd+5 mmJDY3g/w2VMlbGitheW4YZq0jWDo0hNrYmlWiAsx0aF3l6cimIqxUSTfCx2gCfpR3 gByApFXA4R5HQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/12/18 8:55 PM, Dave Chinner wrote: > On Thu, Oct 11, 2018 at 11:00:12PM -0700, john.hubbard@gmail.com wrote: >> From: John Hubbard [...] >> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h >> index 5ed8f6292a53..017ab82e36ca 100644 >> --- a/include/linux/mm_types.h >> +++ b/include/linux/mm_types.h >> @@ -78,12 +78,22 @@ struct page { >> */ >> union { >> struct { /* Page cache and anonymous pages */ >> - /** >> - * @lru: Pageout list, eg. active_list protected by >> - * zone_lru_lock. Sometimes used as a generic list >> - * by the page owner. >> - */ >> - struct list_head lru; >> + union { >> + /** >> + * @lru: Pageout list, eg. active_list protected >> + * by zone_lru_lock. Sometimes used as a >> + * generic list by the page owner. >> + */ >> + struct list_head lru; >> + /* Used by get_user_pages*(). Pages may not be >> + * on an LRU while these dma_pinned_* fields >> + * are in use. >> + */ >> + struct { >> + unsigned long dma_pinned_flags; >> + atomic_t dma_pinned_count; >> + }; >> + }; > > Isn't this broken for mapped file-backed pages? i.e. they may be > passed as the user buffer to read/write direct IO and so the pages > passed to gup will be on the active/inactive LRUs. hence I can't see > how you can have dual use of the LRU list head like this.... > > What am I missing here? Hi Dave, In patch 6/6, pin_page_for_dma(), which is called at the end of get_user_pages(), unceremoniously rips the pages out of the LRU, as a prerequisite to using either of the page->dma_pinned_* fields. The idea is that LRU is not especially useful for this situation anyway, so we'll just make it one or the other: either a page is dma-pinned, and just hanging out doing RDMA most likely (and LRU is less meaningful during that time), or it's possibly on an LRU list. -- thanks, John Hubbard NVIDIA