From: John Hubbard <jhubbard@nvidia.com>
To: Ira Weiny <ira.weiny@intel.com>
Cc: Artemy Kovalyov <artemyko@mellanox.com>,
"john.hubbard@gmail.com" <john.hubbard@gmail.com>,
"linux-mm@kvack.org" <linux-mm@kvack.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>,
Jason Gunthorpe <jgg@ziepe.ca>,
Doug Ledford <dledford@redhat.com>,
"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths
Date: Tue, 5 Mar 2019 12:10:03 -0800 [thread overview]
Message-ID: <9502d777-73e1-f96f-120d-acc1f31045ae@nvidia.com> (raw)
In-Reply-To: <20190304201338.GA28731@iweiny-DESK2.sc.intel.com>
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
>
> <quoute>
> 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).
> </quote>
>
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
next prev parent reply other threads:[~2019-03-05 20:10 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-02 3:27 [PATCH 0/1] " john.hubbard
2019-03-02 3:27 ` [PATCH] " john.hubbard
2019-03-02 16:03 ` kbuild test robot
2019-03-02 16:14 ` kbuild test robot
2019-03-02 20:24 ` [PATCH v2] " john.hubbard
2019-03-02 19:44 ` Ira Weiny
2019-03-03 9:52 ` Artemy Kovalyov
2019-03-03 16:55 ` Ira Weiny
2019-03-04 23:11 ` John Hubbard
2019-03-04 20:13 ` Ira Weiny
2019-03-05 20:10 ` John Hubbard [this message]
2019-03-04 23:36 ` John Hubbard
2019-03-05 0:53 ` Jason Gunthorpe
2019-03-03 22:37 ` John Hubbard
2019-03-04 6:44 ` Leon Romanovsky
2019-03-06 1:02 ` Artemy Kovalyov
2019-03-06 1:32 ` Jason Gunthorpe
2019-03-06 1:34 ` John Hubbard
2019-03-06 1:37 ` John Hubbard
2019-03-06 1:51 ` Jason Gunthorpe
2019-03-06 2:04 ` John Hubbard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9502d777-73e1-f96f-120d-acc1f31045ae@nvidia.com \
--to=jhubbard@nvidia.com \
--cc=akpm@linux-foundation.org \
--cc=artemyko@mellanox.com \
--cc=dledford@redhat.com \
--cc=ira.weiny@intel.com \
--cc=jgg@ziepe.ca \
--cc=john.hubbard@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox