[PATCH v6 02/24] mm/gup: factor out duplicate code from four routines