diff mbox series

[v2,04/13] mm/gup: move try_grab_page() to mm/internal.h

Message ID 4-v2-987e91b59705+36b-gup_tidy_jgg@nvidia.com (mailing list archive)
State New
Headers show
Series Simplify the external interface for GUP | expand

Commit Message

Jason Gunthorpe Jan. 24, 2023, 8:34 p.m. UTC
This is part of the internal function of gup.c and is only non-static so
that the parts of gup.c in the huge_memory.c and hugetlb.c can call it.

Put it in internal.h beside the similarly purposed try_grab_folio()

Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
---
 include/linux/mm.h | 2 --
 mm/internal.h      | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

John Hubbard Jan. 25, 2023, 2:15 a.m. UTC | #1
On 1/24/23 12:34, Jason Gunthorpe wrote:
> This is part of the internal function of gup.c and is only non-static so
> that the parts of gup.c in the huge_memory.c and hugetlb.c can call it.
> 
> Put it in internal.h beside the similarly purposed try_grab_folio()
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>   include/linux/mm.h | 2 --
>   mm/internal.h      | 1 +
>   2 files changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: John Hubbard <jhubbard@nvidia.com>

thanks,
David Hildenbrand Feb. 8, 2023, 2:26 p.m. UTC | #2
On 24.01.23 21:34, Jason Gunthorpe wrote:
> This is part of the internal function of gup.c and is only non-static so
> that the parts of gup.c in the huge_memory.c and hugetlb.c can call it.
> 
> Put it in internal.h beside the similarly purposed try_grab_folio()
> 
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
>   include/linux/mm.h | 2 --
>   mm/internal.h      | 1 +
>   2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/include/linux/mm.h b/include/linux/mm.h
> index c9db257f09b307..dfc2a88bc4a8ed 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1173,8 +1173,6 @@ static inline void get_page(struct page *page)
>   	folio_get(page_folio(page));
>   }
>   
> -int __must_check try_grab_page(struct page *page, unsigned int flags);
> -
>   static inline __must_check bool try_get_page(struct page *page)
>   {
>   	page = compound_head(page);
> diff --git a/mm/internal.h b/mm/internal.h
> index ce462bf145b441..0f035bcaf133f5 100644
> --- a/mm/internal.h
> +++ b/mm/internal.h
> @@ -852,6 +852,7 @@ int migrate_device_coherent_page(struct page *page);
>    * mm/gup.c
>    */
>   struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags);
> +int __must_check try_grab_page(struct page *page, unsigned int flags);
>   
>   extern bool mirrored_kernelcore;
>   

Reviewed-by: David Hildenbrand <david@redhat.com>
diff mbox series

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index c9db257f09b307..dfc2a88bc4a8ed 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1173,8 +1173,6 @@  static inline void get_page(struct page *page)
 	folio_get(page_folio(page));
 }
 
-int __must_check try_grab_page(struct page *page, unsigned int flags);
-
 static inline __must_check bool try_get_page(struct page *page)
 {
 	page = compound_head(page);
diff --git a/mm/internal.h b/mm/internal.h
index ce462bf145b441..0f035bcaf133f5 100644
--- a/mm/internal.h
+++ b/mm/internal.h
@@ -852,6 +852,7 @@  int migrate_device_coherent_page(struct page *page);
  * mm/gup.c
  */
 struct folio *try_grab_folio(struct page *page, int refs, unsigned int flags);
+int __must_check try_grab_page(struct page *page, unsigned int flags);
 
 extern bool mirrored_kernelcore;