Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp560396imm; Mon, 9 Jul 2018 06:50:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe0URrfa5W/kG0JL72PeH9LuFnFPP5wSiiWq8Wc6DC6L2SlaNSD+P9cOt5cOZIXKiZkNjji X-Received: by 2002:a63:65c2:: with SMTP id z185-v6mr12839521pgb.276.1531144245370; Mon, 09 Jul 2018 06:50:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531144245; cv=none; d=google.com; s=arc-20160816; b=pUHgVuOF/d/g+K27JhN0Mz3zRRuWMDAtf5wrCIXNBo6LMCRautD3A14e7kCLwT02Jv tNoa5wYouVs4DeG8FjL9n5ZkJS34Kanilo0x/MIOLZdSvtlHfw+ZWhliPOyD/FpIVLQI Nroei2GU0lHeJA3IQKj//n/2z3UP7PK+Z1h5UiooDxBCimYEeBU1203CVVolLu3Gnj6o fSdjbF8VfAM0T9n6Vs87qXCSxwZITYYZL4lqFQ4+71D0L2yAUs57TeNjFPPKlXCts411 Xwvf8LjsP5/SCmst3ITtFKvpai4Mvg1pa1BADH1+TOODVXG2M65uRm+fBf35Uuw7joNo bBnA== 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:arc-authentication-results; bh=0xtEp4Wcv2Hqy8nhrBAKrcnw5LfDVDqjdIxypAAQCxU=; b=xu0hOtvYloe3Nybdia9j1VFZwRhPRkZYUbK94olDLYS5xc6L3rICGRbMuPXCtlAcwV 2kmigpNykiL83pSn6DX62iI9xCb1vph2/RJVR3nxLRleT+HZXw7C9sOeeNLNgBolnl46 t/P3fPQdWDuV5RK33CbHh7l0DtzmAcQ1yjkiyK8EAxclZ52IkCX3pMs7L8CUXywxaIyV 7nMuz+nNo8faHQ96nbfdxgVCi8JZNaPFGKkQ2m3BSV7I3hSSXuazJQ7YrG08wK0z0bCX 25pLbRd8/vRUmElzsoVQOibFnbM8uLl1ZYMSRWi5Rin9rwk8Mbp2ytIB3jI2+nzPcSdY laQw== 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 g9-v6si13378148pgs.385.2018.07.09.06.50.30; Mon, 09 Jul 2018 06:50:45 -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 S932675AbeGINtq (ORCPT + 99 others); Mon, 9 Jul 2018 09:49:46 -0400 Received: from mx2.suse.de ([195.135.220.15]:57668 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754437AbeGINto (ORCPT ); Mon, 9 Jul 2018 09:49:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 3EE01AE4E; Mon, 9 Jul 2018 13:49:43 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 256011E3C36; Mon, 9 Jul 2018 15:49:37 +0200 (CEST) Date: Mon, 9 Jul 2018 15:49:37 +0200 From: Jan Kara To: Christopher Lameter Cc: Jan Kara , John Hubbard , john.hubbard@gmail.com, Matthew Wilcox , Michal Hocko , Jason Gunthorpe , Dan Williams , linux-mm@kvack.org, LKML , linux-rdma , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH v2 5/6] mm: track gup pages with page->dma_pinned_* fields Message-ID: <20180709134937.fqk77w2jjw62lw6m@quack2.suse.cz> References: <20180702005654.20369-1-jhubbard@nvidia.com> <20180702005654.20369-6-jhubbard@nvidia.com> <20180702095331.n5zfz35d3invl5al@quack2.suse.cz> <010001645d77ee2c-de7fedbd-f52d-4b74-9388-e6435973792b-000000@email.amazonses.com> <01000164611dacae-5ac25e48-b845-43ef-9992-fc1047d8e0a0-000000@email.amazonses.com> <3c71556f-1d71-873a-6f74-121865568bf7@nvidia.com> <20180704104318.f5pnqtnn3unkwauw@quack2.suse.cz> <010001646acdf1d8-0460be04-cc74-4a2d-be89-a337461bd485-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <010001646acdf1d8-0460be04-cc74-4a2d-be89-a337461bd485-000000@email.amazonses.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 05-07-18 14:17:19, Christopher Lameter wrote: > On Wed, 4 Jul 2018, Jan Kara wrote: > > > > So this seems unsolvable without having the caller specify that it knows the > > > page type, and that it is therefore safe to decrement page->dma_pinned_count. > > > I was hoping I'd found a way, but clearly I haven't. :) > > > > Well, I think the misconception is that "pinned" is a fundamental property > > of a page. It is not. "pinned" is a property of a page reference (i.e., a > > kind of reference that can be used for DMA access) and page gets into > > "pinned" state if it has any reference of "pinned" type. And when you > > realize this, it is obvious that you just have to have a special api for > > getting and dropping references of this "pinned" type. For getting we > > already have get_user_pages(), for putting we have to create the api... > > Maybe we can do something by creating a special "pinned" bit in the pte? > If it is a RDMA reference then set that pinned bit there. > > Thus any of the references could cause a pin. Since the page struct does > not contain that information we therefore have to scan through the ptes to > figure out if a page is pinned? > > If so then we would not need a special function for dropping the > reference. I don't really see how a PTE bit would help in getting rid of the special function for dropping "pinned" reference. You still need to distinguish preexisting page references (and corresponding page ref drops which must not unpin the page) from the references acquired after transitioning PTE to the pinned state... Honza -- Jan Kara SUSE Labs, CR