mbox series

[0/8] Simplify the external interface for GUP

Message ID 0-v1-dd94f8f0d5ad+716-gup_tidy_jgg@nvidia.com (mailing list archive)
Headers show
Series Simplify the external interface for GUP | expand

Message

Jason Gunthorpe Jan. 17, 2023, 3:58 p.m. UTC
It is quite a maze of EXPORTED symbols leading up to the three actual
worker functions of GUP. Simplify this by reorganizing some of the code so
the EXPORTED symbols directly call the correct internal function with
validated and consistent arguments.

Consolidate all the assertions into one place at the top of the call
chains.

Remove some dead code.

Jason Gunthorpe (8):
  mm/gup: have internal functions get the mmap_read_lock()
  mm/gup: don't call __gup_longterm_locked() if FOLL_LONGTERM cannot be
    set
  mm/gup: simplify the external interface functions and consolidate
    invariants
  mm/gup: add an assertion that the mmap lock is locked
  mm/gup: add FOLL_UNLOCK
  mm/gup: make locked never NULL in the internal GUP functions
  mm/gup: remove pin_user_pages_fast_only()
  mm/gup: make get_user_pages_fast_only() return the common return value

 include/linux/mm.h |   3 +-
 mm/gup.c           | 319 +++++++++++++++++++++------------------------
 mm/huge_memory.c   |  10 --
 3 files changed, 150 insertions(+), 182 deletions(-)


base-commit: 5dc4c995db9eb45f6373a956eb1f69460e69e6d4

Comments

Mike Rapoport Jan. 19, 2023, 11:18 a.m. UTC | #1
On Tue, Jan 17, 2023 at 11:58:31AM -0400, Jason Gunthorpe wrote:
> It is quite a maze of EXPORTED symbols leading up to the three actual
> worker functions of GUP. Simplify this by reorganizing some of the code so
> the EXPORTED symbols directly call the correct internal function with
> validated and consistent arguments.
> 
> Consolidate all the assertions into one place at the top of the call
> chains.
> 
> Remove some dead code.

> Jason Gunthorpe (8):
>   mm/gup: have internal functions get the mmap_read_lock()
>   mm/gup: don't call __gup_longterm_locked() if FOLL_LONGTERM cannot be
>     set
>   mm/gup: simplify the external interface functions and consolidate
>     invariants
>   mm/gup: add an assertion that the mmap lock is locked
>   mm/gup: add FOLL_UNLOCK
>   mm/gup: make locked never NULL in the internal GUP functions
>   mm/gup: remove pin_user_pages_fast_only()
>   mm/gup: make get_user_pages_fast_only() return the common return value
> 
>  include/linux/mm.h |   3 +-
>  mm/gup.c           | 319 +++++++++++++++++++++------------------------
>  mm/huge_memory.c   |  10 --
>  3 files changed, 150 insertions(+), 182 deletions(-)

Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
 
> base-commit: 5dc4c995db9eb45f6373a956eb1f69460e69e6d4
> -- 
> 2.39.0
> 
>