linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] mm: Fix the flipped condition in gfpflags_allow_spinning()
@ 2025-03-10 12:40 Alexei Starovoitov
  2025-03-10 22:30 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Alexei Starovoitov @ 2025-03-10 12:40 UTC (permalink / raw)
  To: bpf; +Cc: daniel, andrii, martin.lau, vbabka, linux-mm, kernel-team

From: Vlastimil Babka <vbabka@suse.cz>

The function gfpflags_allow_spinning() has a bug that makes it return
the opposite result than intended. This could contribute to deadlocks as
usage profilerates, for now it was noticed as a performance regression
due to try_charge_memcg() not refilling memcg stock when it could. Fix
the flipped condition.

Fixes: 97769a53f117 ("mm, bpf: Introduce try_alloc_pages() for opportunistic page allocation")
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202503101254.cfd454df-lkp@intel.com
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
 include/linux/gfp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index ceb226c2e25c..c9fa6309c903 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -55,7 +55,7 @@ static inline bool gfpflags_allow_spinning(const gfp_t gfp_flags)
 	 * regular page allocator doesn't fully support this
 	 * allocation mode.
 	 */
-	return !(gfp_flags & __GFP_RECLAIM);
+	return !!(gfp_flags & __GFP_RECLAIM);
 }
 
 #ifdef CONFIG_HIGHMEM
-- 
2.43.5



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

* Re: [PATCH bpf-next] mm: Fix the flipped condition in gfpflags_allow_spinning()
  2025-03-10 12:40 [PATCH bpf-next] mm: Fix the flipped condition in gfpflags_allow_spinning() Alexei Starovoitov
@ 2025-03-10 22:30 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-10 22:30 UTC (permalink / raw)
  To: Alexei Starovoitov
  Cc: bpf, daniel, andrii, martin.lau, vbabka, linux-mm, kernel-team

Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Mon, 10 Mar 2025 13:40:17 +0100 you wrote:
> From: Vlastimil Babka <vbabka@suse.cz>
> 
> The function gfpflags_allow_spinning() has a bug that makes it return
> the opposite result than intended. This could contribute to deadlocks as
> usage profilerates, for now it was noticed as a performance regression
> due to try_charge_memcg() not refilling memcg stock when it could. Fix
> the flipped condition.
> 
> [...]

Here is the summary with links:
  - [bpf-next] mm: Fix the flipped condition in gfpflags_allow_spinning()
    https://git.kernel.org/bpf/bpf-next/c/157a50236c30

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html




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

end of thread, other threads:[~2025-03-10 22:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-10 12:40 [PATCH bpf-next] mm: Fix the flipped condition in gfpflags_allow_spinning() Alexei Starovoitov
2025-03-10 22:30 ` patchwork-bot+netdevbpf

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