From: Christoph Hellwig <hch@infradead.org>
To: Pingfan Liu <kernelfans@gmail.com>
Cc: linux-mm@kvack.org, Ira Weiny <ira.weiny@intel.com>,
Andrew Morton <akpm@linux-foundation.org>,
Mike Rapoport <rppt@linux.ibm.com>,
Dan Williams <dan.j.williams@intel.com>,
Matthew Wilcox <willy@infradead.org>,
John Hubbard <jhubbard@nvidia.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
Christoph Hellwig <hch@infradead.org>,
Shuah Khan <shuah@kernel.org>, Jason Gunthorpe <jgg@ziepe.ca>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCHv7 2/3] mm/gup: fix omission of check on FOLL_LONGTERM in gup fast path
Date: Tue, 17 Mar 2020 05:09:30 -0700 [thread overview]
Message-ID: <20200317120930.GA435@infradead.org> (raw)
In-Reply-To: <1584445652-30064-1-git-send-email-kernelfans@gmail.com>
On Tue, Mar 17, 2020 at 07:47:32PM +0800, Pingfan Liu wrote:
> FOLL_LONGTERM is a special case of FOLL_PIN. It suggests a pin which is
> going to be given to hardware and can't move. It would truncate CMA
> permanently and should be excluded.
>
> In gup slow path, slow path, where
> __gup_longterm_locked->check_and_migrate_cma_pages() handles FOLL_LONGTERM,
> but in fast path, there lacks such a check, which means a possible leak of
> CMA page to longterm pinned.
>
> Place a check in try_grab_compound_head() in the fast path to fix the leak,
> and if FOLL_LONGTERM happens on CMA, it will fall back to slow path to
> migrate the page.
>
> Some note about the check:
> Huge page's subpages have the same migrate type due to either
> allocation from a free_list[] or alloc_contig_range() with param
> MIGRATE_MOVABLE. So it is enough to check on a single subpage
> by is_migrate_cma_page(subpage)
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
next prev parent reply other threads:[~2020-03-17 12:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-16 4:34 [PATCHv6 0/3] fix omission of check on FOLL_LONGTERM in gup fast path Pingfan Liu
2020-03-16 4:34 ` [PATCHv6 1/3] mm/gup: rename nr as nr_pinned in get_user_pages_fast() Pingfan Liu
2020-03-16 8:54 ` Christoph Hellwig
2020-03-16 4:34 ` [PATCHv6 2/3] mm/gup: fix omission of check on FOLL_LONGTERM in gup fast path Pingfan Liu
2020-03-16 8:55 ` Christoph Hellwig
2020-03-17 11:45 ` Pingfan Liu
2020-03-17 11:47 ` [PATCHv7 " Pingfan Liu
2020-03-17 12:09 ` Christoph Hellwig [this message]
2020-03-18 12:15 ` Jason Gunthorpe
[not found] ` <a4e7dc4d-9925-b0c4-e543-4626b94d6f9a@nvidia.com>
2020-03-20 9:19 ` Pingfan Liu
2020-03-16 4:34 ` [PATCHv6 3/3] mm/gup_benchemark: add LONGTERM_BENCHMARK test " Pingfan Liu
[not found] ` <8d748bfe-b2b0-bb56-fb2c-71de86183ba5@nvidia.com>
2020-03-20 9:17 ` Pingfan Liu
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=20200317120930.GA435@infradead.org \
--to=hch@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=dan.j.williams@intel.com \
--cc=ira.weiny@intel.com \
--cc=jgg@ziepe.ca \
--cc=jhubbard@nvidia.com \
--cc=kernelfans@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=rppt@linux.ibm.com \
--cc=shuah@kernel.org \
--cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).