diff mbox series

[1/3] mm/page_alloc: use might_alloc()

Message ID 20220605152539.3196045-1-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show
Series [1/3] mm/page_alloc: use might_alloc() | expand

Commit Message

Daniel Vetter June 5, 2022, 3:25 p.m. UTC
... instead of open codding it. Completely equivalent code, just
a notch more meaningful when reading.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org
---
 mm/page_alloc.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

David Hildenbrand June 7, 2022, 12:57 p.m. UTC | #1
On 05.06.22 17:25, Daniel Vetter wrote:
> ... instead of open codding it. Completely equivalent code, just
> a notch more meaningful when reading.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> ---
>  mm/page_alloc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 2db95780e003..277774d170cb 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5177,10 +5177,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
>  			*alloc_flags |= ALLOC_CPUSET;
>  	}
>  
> -	fs_reclaim_acquire(gfp_mask);
> -	fs_reclaim_release(gfp_mask);
> -
> -	might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM);
> +	might_alloc(gfp_mask);
>  
>  	if (should_fail_alloc_page(gfp_mask, order))
>  		return false;

Reviewed-by: David Hildenbrand <david@redhat.com>
Vlastimil Babka (SUSE) June 14, 2022, 1:07 p.m. UTC | #2
On 6/5/22 17:25, Daniel Vetter wrote:
> ... instead of open codding it. Completely equivalent code, just
> a notch more meaningful when reading.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org

Reviewed-by: Vlastimil Babka <vbabka@suse.cz>

> ---
>  mm/page_alloc.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 2db95780e003..277774d170cb 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5177,10 +5177,7 @@ static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
>  			*alloc_flags |= ALLOC_CPUSET;
>  	}
>  
> -	fs_reclaim_acquire(gfp_mask);
> -	fs_reclaim_release(gfp_mask);
> -
> -	might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM);
> +	might_alloc(gfp_mask);
>  
>  	if (should_fail_alloc_page(gfp_mask, order))
>  		return false;
diff mbox series

Patch

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 2db95780e003..277774d170cb 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5177,10 +5177,7 @@  static inline bool prepare_alloc_pages(gfp_t gfp_mask, unsigned int order,
 			*alloc_flags |= ALLOC_CPUSET;
 	}
 
-	fs_reclaim_acquire(gfp_mask);
-	fs_reclaim_release(gfp_mask);
-
-	might_sleep_if(gfp_mask & __GFP_DIRECT_RECLAIM);
+	might_alloc(gfp_mask);
 
 	if (should_fail_alloc_page(gfp_mask, order))
 		return false;