diff mbox series

mm/slub: remove duplicate flag in allocate_slab()

Message ID 20220409150538.1264-1-lakroforce@gmail.com (mailing list archive)
State New
Headers show
Series mm/slub: remove duplicate flag in allocate_slab() | expand

Commit Message

Jiyoup Kim April 9, 2022, 3:05 p.m. UTC
In allocate_slab(), __GFP_NOFAIL flag is removed twice when trying
higher-order allocation. Remove it.

Signed-off-by: Jiyoup Kim <lakroforce@gmail.com>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hyeonggon Yoo April 10, 2022, 7:42 a.m. UTC | #1
On Sun, Apr 10, 2022 at 12:05:37AM +0900, Jiyoup Kim wrote:
> In allocate_slab(), __GFP_NOFAIL flag is removed twice when trying
> higher-order allocation. Remove it.
> 
> Signed-off-by: Jiyoup Kim <lakroforce@gmail.com>
> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 74d92aa4a3a2..a0e605ab3036 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1939,7 +1939,7 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
>  	 */
>  	alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_NOFAIL;
>  	if ((alloc_gfp & __GFP_DIRECT_RECLAIM) && oo_order(oo) > oo_order(s->min))
> -		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~(__GFP_RECLAIM|__GFP_NOFAIL);
> +		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~__GFP_RECLAIM;
>  
>  	slab = alloc_slab_page(alloc_gfp, node, oo);
>  	if (unlikely(!slab)) {

Looks good to me.

Reviewed-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>

Thanks!

> -- 
> 2.25.1
> 
>
Muchun Song April 11, 2022, 4 a.m. UTC | #2
On Sun, Apr 10, 2022 at 12:05:37AM +0900, Jiyoup Kim wrote:
> In allocate_slab(), __GFP_NOFAIL flag is removed twice when trying
> higher-order allocation. Remove it.
> 
> Signed-off-by: Jiyoup Kim <lakroforce@gmail.com>

LGTM.

Reviewed-by: Muchun Song <songmuchun@bytedance.com>
Vlastimil Babka April 11, 2022, 10:32 a.m. UTC | #3
On 4/9/22 17:05, Jiyoup Kim wrote:
> In allocate_slab(), __GFP_NOFAIL flag is removed twice when trying
> higher-order allocation. Remove it.
> 
> Signed-off-by: Jiyoup Kim <lakroforce@gmail.com>

Thanks, added.

> ---
>  mm/slub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 74d92aa4a3a2..a0e605ab3036 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -1939,7 +1939,7 @@ static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
>  	 */
>  	alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_NOFAIL;
>  	if ((alloc_gfp & __GFP_DIRECT_RECLAIM) && oo_order(oo) > oo_order(s->min))
> -		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~(__GFP_RECLAIM|__GFP_NOFAIL);
> +		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~__GFP_RECLAIM;
>  
>  	slab = alloc_slab_page(alloc_gfp, node, oo);
>  	if (unlikely(!slab)) {
David Rientjes April 12, 2022, 11:36 p.m. UTC | #4
On Sun, 10 Apr 2022, Jiyoup Kim wrote:

> In allocate_slab(), __GFP_NOFAIL flag is removed twice when trying
> higher-order allocation. Remove it.
> 
> Signed-off-by: Jiyoup Kim <lakroforce@gmail.com>

Acked-by: David Rientjes <rientjes@google.com>
diff mbox series

Patch

diff --git a/mm/slub.c b/mm/slub.c
index 74d92aa4a3a2..a0e605ab3036 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1939,7 +1939,7 @@  static struct slab *allocate_slab(struct kmem_cache *s, gfp_t flags, int node)
 	 */
 	alloc_gfp = (flags | __GFP_NOWARN | __GFP_NORETRY) & ~__GFP_NOFAIL;
 	if ((alloc_gfp & __GFP_DIRECT_RECLAIM) && oo_order(oo) > oo_order(s->min))
-		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~(__GFP_RECLAIM|__GFP_NOFAIL);
+		alloc_gfp = (alloc_gfp | __GFP_NOMEMALLOC) & ~__GFP_RECLAIM;
 
 	slab = alloc_slab_page(alloc_gfp, node, oo);
 	if (unlikely(!slab)) {