aboutsummaryrefslogtreecommitdiffstats
path: root/mm/gup.c
diff options
context:
space:
mode:
authorMatthew Wilcox (Oracle) <willy@infradead.org>2022-01-07 14:19:39 -0500
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-03-21 12:56:35 -0400
commit6315d8a23ce308433cf615e435ca2ee2aee7d11c (patch)
tree660423255c68cc673fd6b7ae2d512b81ec0eb90c /mm/gup.c
parentmm/gup: Remove hpage_pincount_add() (diff)
downloadlinux-dev-6315d8a23ce308433cf615e435ca2ee2aee7d11c.tar.xz
linux-dev-6315d8a23ce308433cf615e435ca2ee2aee7d11c.zip
mm/gup: Remove hpage_pincount_sub()
Move the assertion (and correct it to be a cheaper variant), and inline the atomic_sub() operation. Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: John Hubbard <jhubbard@nvidia.com> Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Diffstat (limited to 'mm/gup.c')
-rw-r--r--mm/gup.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/mm/gup.c b/mm/gup.c
index 299b78736a4a..1809dc037a8e 100644
--- a/mm/gup.c
+++ b/mm/gup.c
@@ -29,14 +29,6 @@ struct follow_page_context {
unsigned int page_mask;
};
-static void hpage_pincount_sub(struct page *page, int refs)
-{
- VM_BUG_ON_PAGE(!hpage_pincount_available(page), page);
- VM_BUG_ON_PAGE(page != compound_head(page), page);
-
- atomic_sub(refs, compound_pincount_ptr(page));
-}
-
/* Equivalent to calling put_page() @refs times. */
static void put_page_refs(struct page *page, int refs)
{
@@ -169,12 +161,13 @@ __maybe_unused struct page *try_grab_compound_head(struct page *page,
static void put_compound_head(struct page *page, int refs, unsigned int flags)
{
+ VM_BUG_ON_PAGE(PageTail(page), page);
+
if (flags & FOLL_PIN) {
mod_node_page_state(page_pgdat(page), NR_FOLL_PIN_RELEASED,
refs);
-
if (hpage_pincount_available(page))
- hpage_pincount_sub(page, refs);
+ atomic_sub(refs, compound_pincount_ptr(page));
else
refs *= GUP_PIN_COUNTING_BIAS;
}