On Fri, Aug 05, 2022 at 04:29:52PM +1000, Alistair Popple wrote: > @@ -2053,7 +2046,9 @@ static long __gup_longterm_locked(struct mm_struct *mm, > NULL, gup_flags); > if (rc <= 0) > break; > - rc = check_and_migrate_movable_pages(rc, pages, gup_flags); > + > + WARN_ON_ONCE(!(gup_flags & FOLL_PIN)); > + rc = check_and_migrate_movable_pages(rc, pages); This should be moved up: if (!(gup_flags & FOLL_LONGTERM)) return __get_user_pages_locked(mm, start, nr_pages, pages, vmas, NULL, gup_flags); if (WARN_ON(!(gup_flags & FOLL_PIN))) return -EINVAL; flags = memalloc_pin_save(); Jason