diff --git a/mm/gup.c b/mm/gup.c index 2f8bf7a71c745a3e64fd058a0b7574d9603c26c8..7763abd16405521e8607a0de2a74469a65231c34 100644 --- a/mm/gup.c +++ b/mm/gup.c @@ -2006,7 +2006,8 @@ static int gup_hugepte(pte_t *ptep, unsigned long sz, unsigned long addr, refs++; } while (addr += PAGE_SIZE, addr != end); - if (!page_cache_add_speculative(head, refs)) { + head = try_get_compound_head(head, refs); + if (!head) { *nr -= refs; return 0; }