Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1505348imm; Fri, 12 Oct 2018 20:55:59 -0700 (PDT) X-Google-Smtp-Source: ACcGV633cpw/cprhwchGEY/hMyePEkIjqwJQeRDlY86CWVWyXUa6jDsQI0E5i8MVxXW9gVuBXFFo X-Received: by 2002:a62:9316:: with SMTP id b22-v6mr9050879pfe.193.1539402959061; Fri, 12 Oct 2018 20:55:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539402959; cv=none; d=google.com; s=arc-20160816; b=GlauCFppeKkOvOX1TvpT8yL3cc2sQJcr1Vdy+WEYT8GsL1DHAfV0ZfyAe2emJmvMZW kHp+C46WWM3UxyoGmY22uz5YhC8o15yYdzcG8uoQTZdVVvEFM287cPcfpC0hqHK6ZAm7 EvoOKF5y2josJM6ajXUDCr6nnbDBfv8psHLPEh5EOYwxfCHnoDkYbABlSNfVQC/mgKiB usHoVOJw+SYSb8CsoPXGvmeWCL/x1bI448qwiAc22aabkg5EMQCBuv8G6uiImmsU9IbC 7LOZsHTtE6eAyNCVCU5g0TvV2Y1SxgUiu3RiMAwdK3GsOv1Hi9TuJtO2F0DPvJmOOYn7 DPDA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=FBKeE6jFLnFg3Lnp11dccfGIxxgrPI2kzZCtYT5l++U=; b=HhLET0OsONFGEpJWXDplbOmD1INmOGcZPwiMBWhrJPTlbfytr0Cg76p8CYtz00UE4f hXHQvkLLUk17BkfE3G1MaFIjYsck7rEvMbsS5hc2XdLsoYWfnvobODpVySxxrNb4sgxm uhTUV87IbhhR4WA4T9+M1eM+TZzd4xPVT/aXxWJ7Li+puK2gJ0EsCNbQxvCbucMhp9lM 01NuIS/JX/8xNjCWSwItE+tPJlYTexnnnA1pLYO+FoTXM70il85DkQF43KoJli64ZR6n gc7uZONOsKd2oupLEKaQGYXfx+u1UCAGP0VeJAegwvOirI2MTykuqDgsRe+LOicG6SZC cOQA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7-v6si3567277pgf.273.2018.10.12.20.55.42; Fri, 12 Oct 2018 20:55:59 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbeJMLax (ORCPT + 99 others); Sat, 13 Oct 2018 07:30:53 -0400 Received: from ipmail06.adl6.internode.on.net ([150.101.137.145]:12504 "EHLO ipmail06.adl6.internode.on.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725970AbeJMLaw (ORCPT ); Sat, 13 Oct 2018 07:30:52 -0400 Received: from ppp59-167-129-252.static.internode.on.net (HELO dastard) ([59.167.129.252]) by ipmail06.adl6.internode.on.net with ESMTP; 13 Oct 2018 14:25:17 +1030 Received: from dave by dastard with local (Exim 4.80) (envelope-from ) id 1gBB1I-0006ci-Tz; Sat, 13 Oct 2018 14:55:16 +1100 Date: Sat, 13 Oct 2018 14:55:16 +1100 From: Dave Chinner To: john.hubbard@gmail.com Cc: Matthew Wilcox , Michal Hocko , Christopher Lameter , Jason Gunthorpe , Dan Williams , Jan Kara , linux-mm@kvack.org, Andrew Morton , LKML , linux-rdma , linux-fsdevel@vger.kernel.org, John Hubbard Subject: Re: [PATCH 4/6] mm: introduce page->dma_pinned_flags, _count Message-ID: <20181013035516.GA18822@dastard> References: <20181012060014.10242-1-jhubbard@nvidia.com> <20181012060014.10242-5-jhubbard@nvidia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181012060014.10242-5-jhubbard@nvidia.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 11, 2018 at 11:00:12PM -0700, john.hubbard@gmail.com wrote: > From: John Hubbard > > Add two struct page fields that, combined, are unioned with > struct page->lru. There is no change in the size of > struct page. These new fields are for type safety and clarity. > > Also add page flag accessors to test, set and clear the new > page->dma_pinned_flags field. > > The page->dma_pinned_count field will be used in upcoming > patches > > Signed-off-by: John Hubbard > --- > include/linux/mm_types.h | 22 +++++++++++++----- > include/linux/page-flags.h | 47 ++++++++++++++++++++++++++++++++++++++ > 2 files changed, 63 insertions(+), 6 deletions(-) > > 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? Cheers, Dave. -- Dave Chinner david@fromorbit.com