Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8960937imu; Tue, 4 Dec 2018 17:58:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/X1dsCMnnOi9ujTv64JhdAZhgEDoz83PxacA5pQf7cV1ZjxJWMaF4FULXLyXGTiedljqlQZ X-Received: by 2002:a63:1e56:: with SMTP id p22mr8899526pgm.126.1543975124301; Tue, 04 Dec 2018 17:58:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543975124; cv=none; d=google.com; s=arc-20160816; b=bYCbtHV6Vpt5uYN1X3uA3XtWMtrUfw0O1KTZpzkJDlH01isbzzojv6QoTBtqdwV3pA 7xEQIfH/DAF8IUHffGCkA70WDHrFEZZ+apOo9I3rq7MWQ2S5Q9d8RMWUA9jZj7/WuQAV LbYS8K/RtLnD5wlvGQre3kWXp+xbRzvwmuWEjQaSxKRkEbYfU3sK6hA46/1mHPdy7WCF 3hyF2vTp0TicycKg1FMoJU+RtHEqERzizDHI7s4TphPVtzlR3LBj9MACcrX8Ji9hNEl8 fZAKREiIX+V+2t4ViPWLzrqPGGJkautAm4OWMe0iIqtHAYOORGafO/jSiqRjds36MrSL R+TQ== 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=riutGdtVqEoopeJXr4KEyjyCI8UUnSy/FhmO6CvEnG8=; b=xPYtSTi57wV1GKg/Lmphob0HMwSBlYOHu9XziIgdxB28uTpwdqlepgtvBH4DIv45YZ VwEjEdiAJ5o7/DDwxc72l2PBzlLvfLXqp4rlnatuPVKtKP0SiOYg56rXE61inr7tkHPm 1wrFcLae8O80ZMWlFfc6VNSBK3NN+blywcdTBR4TPC+/i2/i915wrBpLZRG4CcD8RYIJ xrY8r8rmyMETDaOYAmEM/HDCS3+VD8cYDW45M4JOxHSN+G6gFZVGFjp5/QiwzfGjXZuq M0xcqgDEYAKIMoBYhNMemqDhSdbdooNV21wDRh0svAT2egnnqJBpL36kCMbavLwZltIk Ai7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=WOzdZqKf; 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 b21si20251545pfb.89.2018.12.04.17.58.29; Tue, 04 Dec 2018 17:58:44 -0800 (PST) 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=WOzdZqKf; 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 S1726813AbeLEB5e (ORCPT + 99 others); Tue, 4 Dec 2018 20:57:34 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:12558 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725834AbeLEB5b (ORCPT ); Tue, 4 Dec 2018 20:57:31 -0500 Received: from hqpgpgate102.nvidia.com (Not Verified[216.228.121.13]) by hqemgate16.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Tue, 04 Dec 2018 17:57:32 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 04 Dec 2018 17:57:30 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 04 Dec 2018 17:57:30 -0800 Received: from [10.110.48.28] (10.124.1.5) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 5 Dec 2018 01:57:30 +0000 Subject: Re: [PATCH 1/2] mm: introduce put_user_page*(), placeholder versions To: Jerome Glisse , Matthew Wilcox CC: Dan Williams , John Hubbard , Andrew Morton , Linux MM , Jan Kara , , Al Viro , , Christoph Hellwig , Christopher Lameter , "Dalessandro, Dennis" , Doug Ledford , Jason Gunthorpe , Michal Hocko , , , Linux Kernel Mailing List , linux-fsdevel References: <20181204001720.26138-1-jhubbard@nvidia.com> <20181204001720.26138-2-jhubbard@nvidia.com> <3c91d335-921c-4704-d159-2975ff3a5f20@nvidia.com> <20181205011519.GV10377@bombadil.infradead.org> <20181205014441.GA3045@redhat.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <59ca5c4b-fd5b-1fc6-f891-c7986d91908e@nvidia.com> Date: Tue, 4 Dec 2018 17:57:29 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.2 MIME-Version: 1.0 In-Reply-To: <20181205014441.GA3045@redhat.com> X-Originating-IP: [10.124.1.5] X-ClientProxiedBy: HQMAIL108.nvidia.com (172.18.146.13) To HQMAIL101.nvidia.com (172.20.187.10) Content-Type: text/plain; charset="utf-8" Content-Language: en-US-large Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1543975052; bh=riutGdtVqEoopeJXr4KEyjyCI8UUnSy/FhmO6CvEnG8=; h=X-PGP-Universal:Subject:To:CC:References:From:X-Nvconfidentiality: Message-ID:Date:User-Agent:MIME-Version:In-Reply-To: X-Originating-IP:X-ClientProxiedBy:Content-Type:Content-Language: Content-Transfer-Encoding; b=WOzdZqKfxzIIXSxp1blMM9mM7ba/s1YiJ6raIFhBnvsnmS8kdEj5y6vvMVNp04ulu R3JzAfIXDNvXGooki7lzL4TtU2sFfGwgojlZQCmx3R9Eo4xGoVp6MnlwxFs51fgEpV Gf2kSDh+H+Dp+ZHgv3OEzmnfy3i+PJDNSCpNZpJ0tVO0ehGsXvCs6JhuoUkYLFSC+A ST5DFr4slAsaX3cLYp3rC/ZsAjvOgj0seYrz7eWKppMncYy4+yP+tLr4xfzSDxo80K pgXcaP9k0AzUcRUCOqmvOWpeE5+8E8ei4H7j3WL722zf1H1rCsStTqIe3x7iiOuvGt BkvQH2ADevo5Q== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/4/18 5:44 PM, Jerome Glisse wrote: > On Tue, Dec 04, 2018 at 05:15:19PM -0800, Matthew Wilcox wrote: >> On Tue, Dec 04, 2018 at 04:58:01PM -0800, John Hubbard wrote: >>> On 12/4/18 3:03 PM, Dan Williams wrote: >>>> Except the LRU fields are already in use for ZONE_DEVICE pages... how >>>> does this proposal interact with those? >>> >>> Very badly: page->pgmap and page->hmm_data both get corrupted. Is there an entire >>> use case I'm missing: calling get_user_pages() on ZONE_DEVICE pages? Said another >>> way: is it reasonable to disallow calling get_user_pages() on ZONE_DEVICE pages? >>> >>> If we have to support get_user_pages() on ZONE_DEVICE pages, then the whole >>> LRU field approach is unusable. >> >> We just need to rearrange ZONE_DEVICE pages. Please excuse the whitespace >> damage: >> >> +++ b/include/linux/mm_types.h >> @@ -151,10 +151,12 @@ struct page { >> #endif >> }; >> struct { /* ZONE_DEVICE pages */ >> + unsigned long _zd_pad_2; /* LRU */ >> + unsigned long _zd_pad_3; /* LRU */ >> + unsigned long _zd_pad_1; /* uses mapping */ >> /** @pgmap: Points to the hosting device page map. */ >> struct dev_pagemap *pgmap; >> unsigned long hmm_data; >> - unsigned long _zd_pad_1; /* uses mapping */ >> }; >> >> /** @rcu_head: You can use this to free a page by RCU. */ >> >> You don't use page->private or page->index, do you Dan? > > page->private and page->index are use by HMM DEVICE page. > OK, so for the ZONE_DEVICE + HMM case, that leaves just one field remaining for dma-pinned information. Which might work. To recap, we need: -- 1 bit for PageDmaPinned -- 1 bit, if using LRU field(s), for PageDmaPinnedWasLru. -- N bits for a reference count Those *could* be packed into a single 64-bit field, if really necessary. thanks, -- John Hubbard NVIDIA