The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH] lib/rhashtable: cleanup fallback check in bucket_table_alloc()
@ 2024-08-06 15:39 Davidlohr Bueso
  2024-08-09  7:56 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2024-08-06 15:39 UTC (permalink / raw)
  To: akpm; +Cc: mhocko, 21cnbao, herbert, dave, linux-kernel, Michal Hocko

Upon allocation failure, the current check with the nofail bits
is unnecessary, and further stands in the way of discouraging
direct use of __GFP_NOFAIL. Remove this and replace with the
proper way of determining if doing a non-blocking allocation
for the nested table case.

Suggested-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>
---
 lib/rhashtable.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index dbbed19f8fff..6c902639728b 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -189,7 +189,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
 
 	size = nbuckets;
 
-	if (tbl == NULL && (gfp & ~__GFP_NOFAIL) != GFP_KERNEL) {
+	if (tbl == NULL && !gfpflags_allow_blocking(gfp)) {
 		tbl = nested_bucket_table_alloc(ht, nbuckets, gfp);
 		nbuckets = 0;
 	}
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] lib/rhashtable: cleanup fallback check in bucket_table_alloc()
  2024-08-06 15:39 [PATCH] lib/rhashtable: cleanup fallback check in bucket_table_alloc() Davidlohr Bueso
@ 2024-08-09  7:56 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2024-08-09  7:56 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: akpm, 21cnbao, herbert, linux-kernel

On Tue 06-08-24 08:39:27, Davidlohr Bueso wrote:
> Upon allocation failure, the current check with the nofail bits
> is unnecessary, and further stands in the way of discouraging
> direct use of __GFP_NOFAIL. Remove this and replace with the
> proper way of determining if doing a non-blocking allocation
> for the nested table case.
> 
> Suggested-by: Michal Hocko <mhocko@suse.com>
> Signed-off-by: Davidlohr Bueso <dave@stgolabs.net>

Thanks. This is not really something I feel qualified to ack but the
change looks good to me.

> ---
>  lib/rhashtable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/rhashtable.c b/lib/rhashtable.c
> index dbbed19f8fff..6c902639728b 100644
> --- a/lib/rhashtable.c
> +++ b/lib/rhashtable.c
> @@ -189,7 +189,7 @@ static struct bucket_table *bucket_table_alloc(struct rhashtable *ht,
>  
>  	size = nbuckets;
>  
> -	if (tbl == NULL && (gfp & ~__GFP_NOFAIL) != GFP_KERNEL) {
> +	if (tbl == NULL && !gfpflags_allow_blocking(gfp)) {
>  		tbl = nested_bucket_table_alloc(ht, nbuckets, gfp);
>  		nbuckets = 0;
>  	}
> -- 
> 2.45.2

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-09  7:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-06 15:39 [PATCH] lib/rhashtable: cleanup fallback check in bucket_table_alloc() Davidlohr Bueso
2024-08-09  7:56 ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox