Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp3551506imb; Tue, 5 Mar 2019 12:21:58 -0800 (PST) X-Google-Smtp-Source: APXvYqwgUZ+Mkw7yd+dxxE83X1W3/zSb7rcm2CMTq8qRtedU5yz4YcFk64VRIp5nmdtppAb2g4VA X-Received: by 2002:aa7:8c8c:: with SMTP id p12mr3765404pfd.0.1551817318014; Tue, 05 Mar 2019 12:21:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551817318; cv=none; d=google.com; s=arc-20160816; b=LCqC5kruNcoYSPB9e7xn3I6g9nAFxC1nSYde/RyoIta0vc/7WtAvotNU/pGRBptPox xoLOONA72VXmFUpzh7ns7WvyFi43GrzDZT/Jpqujm44KN3ASuguKn6FPhOvDIKJ/f0iU 5QAspYJWvQVicGUk+mqyKmSXKAhAnEYeE2sWrYd7tDVBodIBpg28Q9pVgnD1TZY8anuX L4E9LjgaDMmn6vyNULkWyzUSUchufe9N5lko4bxTnPGjh2FgfFHMR5JbTERTBKAB/B27 Fvl46wwai+5Trw5hkbPQmPm49vQY+yObA0uvqOolUOyu3M/LCsvWB05WueNJJ/jF3Bnj OvUA== 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=nFm92H0F0foev1f/IZP1befItBmU4OpaeUP7oINCO1c=; b=FICAGgXiP9TbiOpIKZuF6CLZbQ1MDkbjSnnGCvU70DPfXbPqK+C5ik2+5vhyHjm3bQ t6di1Nj3MiEeolCToLeoT7j3hvLYPyfyZyYCbzR08rfndXGor3S1/NX0WerhJ63Uspvh BjFkczXEf8ho3gFyfZiJgZD8aD5D7XrbV3KjW1DfAeLveWaKnWCngVQiasZElpiY21vA ueZJElALytEReKpyrgfFdYlMAbg2YDEpDQYDdYuKwedhhm+AGE0OThwnCz0wcDDajdfH Ll/3bWwvZSZVrbczlDtzAqE6xenbNYPmWRL7qRs0DoS+1uLnCedjqhBZoozDqeF3cJ9S FS1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=lce5inAw; 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 m26si8920268pfi.247.2019.03.05.12.21.42; Tue, 05 Mar 2019 12:21:57 -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=lce5inAw; 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 S1728147AbfCEUKF (ORCPT + 99 others); Tue, 5 Mar 2019 15:10:05 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:1718 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726559AbfCEUKE (ORCPT ); Tue, 5 Mar 2019 15:10:04 -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, 05 Mar 2019 12:10:03 -0800 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate102.nvidia.com (PGP Universal service); Tue, 05 Mar 2019 12:10:04 -0800 X-PGP-Universal: processed; by hqpgpgate102.nvidia.com on Tue, 05 Mar 2019 12:10:04 -0800 Received: from [10.110.48.28] (172.20.13.39) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Tue, 5 Mar 2019 20:10:03 +0000 Subject: Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths To: Ira Weiny CC: Artemy Kovalyov , "john.hubbard@gmail.com" , "linux-mm@kvack.org" , Andrew Morton , LKML , Jason Gunthorpe , Doug Ledford , "linux-rdma@vger.kernel.org" References: <20190302032726.11769-2-jhubbard@nvidia.com> <20190302202435.31889-1-jhubbard@nvidia.com> <20190302194402.GA24732@iweiny-DESK2.sc.intel.com> <2404c962-8f6d-1f6d-0055-eb82864ca7fc@mellanox.com> <20190303165550.GB27123@iweiny-DESK2.sc.intel.com> <20190304201338.GA28731@iweiny-DESK2.sc.intel.com> From: John Hubbard X-Nvconfidentiality: public Message-ID: <9502d777-73e1-f96f-120d-acc1f31045ae@nvidia.com> Date: Tue, 5 Mar 2019 12:10:03 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190304201338.GA28731@iweiny-DESK2.sc.intel.com> X-Originating-IP: [172.20.13.39] X-ClientProxiedBy: HQMAIL107.nvidia.com (172.20.187.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=1551816603; bh=nFm92H0F0foev1f/IZP1befItBmU4OpaeUP7oINCO1c=; 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=lce5inAwqd2AW64oEefNbUeVk4kKbL7wNLqPT2AyKiDspWK8bgalRoKahUSdq23ma 1lAf+Ll8ipe6pkApZLtol2TNcVoGkWVKX6c3KFar0vxUn2z1s7JlFtdH/aE5Vi80Kn Z3UQnMOqPIkyFs6vR88OtS4FCnUzwQxhIRfiG2HZSSzJUq2n1WNjcsYWPHT+qlrdm0 yR5uao9zObAzIcVTBibXwodKbWFuvP9di72kverwQKzBoROP8u4YUuguQvzx26WYpn 2QsMMicMCoDJhiMIhl9BMsux3tIGPY0aMUHIGgfzrsNXxgeUGAz9M/pFXF/RyWXBer Gst1xAnYdNfHw== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/4/19 12:13 PM, Ira Weiny wrote: [snip] >> And this reminds me that I have a problem to solve nearby: get_user_pages >> on huge pages increments the page->_refcount *for each tail page* as well. >> That's a minor problem for my put_user_page() >> patchset, because my approach so far assumed that I could just change us >> over to: >> >> get_user_page(): increments page->_refcount by a large amount (1024) >> >> put_user_page(): decrements page->_refcount by a large amount (1024) >> >> ...and just stop doing the odd (to me) technique of incrementing once for >> each tail page. I cannot see any reason why that's actually required, as >> opposed to just "raise the page->_refcount enough to avoid losing the head >> page too soon". > > What about splitting a huge page? > > From Documention/vm/transhuge.rst > > > split_huge_page internally has to distribute the refcounts in the head > page to the tail pages before clearing all PG_head/tail bits from the page > structures. It can be done easily for refcounts taken by page table > entries. But we don't have enough information on how to distribute any > additional pins (i.e. from get_user_pages). split_huge_page() fails any > requests to split pinned huge page: it expects page count to be equal to > sum of mapcount of all sub-pages plus one (split_huge_page caller must > have reference for head page). > > heh, so in the end, split_huge_page just needs enough information to say "no" for gup pages. So as long as page->_refcount avoids one particular value, the code keeps working. :) > FWIW, I'm not sure why it needs to "store" the reference in the head page for > this. I don't see any check to make sure the ref has been "stored" but I'm not > really familiar with the compound page code yet. > > Ira > Thanks for peeking at this, I'll look deeper too. thanks, -- John Hubbard NVIDIA