]> www.infradead.org Git - nvme.git/commitdiff
mm: Fix the flipped condition in gfpflags_allow_spinning()
authorVlastimil Babka <vbabka@suse.cz>
Mon, 10 Mar 2025 12:40:17 +0000 (13:40 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 15 Mar 2025 18:18:19 +0000 (11:18 -0700)
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>
Acked-by: Shakeel Butt <shakeel.butt@linux.dev>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250310124017.187-1-alexei.starovoitov@gmail.com
Closes: https://lore.kernel.org/oe-lkp/202503101254.cfd454df-lkp@intel.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/linux/gfp.h

index ceb226c2e25c58981c3cbef570633a83d3997274..c9fa6309c903b6dead58f5c1568981872d7b850a 100644 (file)
@@ -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