diff mbox series

[linux-next:master,memcg] 01d37228d3: netperf.Throughput_Mbps 37.9% regression

Message ID CAADnVQ+MCxQsrVWC_DmQfwBxwv8pUw_9gXFJmO54Syybwwp6oQ@mail.gmail.com (mailing list archive)
State Not Applicable
Headers show
Series [linux-next:master,memcg] 01d37228d3: netperf.Throughput_Mbps 37.9% regression | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Alexei Starovoitov March 10, 2025, 11:15 a.m. UTC
fwd to bpf list for BPF CI to pick it up.

---------- Forwarded message ---------
From: Vlastimil Babka <vbabka@suse.cz>
Date: Mon, Mar 10, 2025 at 12:03 PM
Subject: Re: [linux-next:master] [memcg] 01d37228d3:
netperf.Throughput_Mbps 37.9% regression
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: kernel test robot <oliver.sang@intel.com>, Alexei Starovoitov
<ast@kernel.org>, <oe-lkp@lists.linux.dev>, kbuild test robot
<lkp@intel.com>, Michal Hocko <mhocko@suse.com>, Shakeel Butt
<shakeel.butt@linux.dev>, open list:CONTROL GROUP (CGROUP)
<cgroups@vger.kernel.org>, linux-mm <linux-mm@kvack.org>


On 3/10/25 11:56, Alexei Starovoitov wrote:
> On Mon, Mar 10, 2025 at 11:34 AM Vlastimil Babka <vbabka@suse.cz> wrote:
>>
>> On 3/10/25 11:18, Alexei Starovoitov wrote:
>> >> because this will affect the refill even if consume_stock() fails not due to
>> >> a trylock failure (which should not be happening), but also just because the
>> >> stock was of a wrong memcg or depleted. So in the nowait context we deny the
>> >> refill even if we have the memory. Attached patch could be used to see if it
>> >> if fixes things. I'm not sure about the testcases where it doesn't look like
>> >> nowait context would be used though, let's see.
>> >
>> > Not quite.
>> > GFP_NOWAIT includes __GFP_KSWAPD_RECLAIM,
>> > so gfpflags_allow_spinning() will return true.
>>
>> Uh right, it's the new gfpflags_allow_spinning(), not the
>> gfpflags_allow_blocking() I'm used to and implicitly assumed, sorry.
>>
>> But then it's very simple because it has a bug:
>> gfpflags_allow_spinning() does
>>
>> return !(gfp_flags & __GFP_RECLAIM);
>>
>> should be !!
>
> Ouch.
> So I accidentally exposed the whole linux-next to this stress testing
> of new trylock facilities :(
> But the silver lining is that this is the only thing that blew up :)
> Could you send a patch or I will do it later today.

OK
----8<----
From 69b3d1631645c82d9d88f17fb01184d24034df2b Mon Sep 17 00:00:00 2001
From: Vlastimil Babka <vbabka@suse.cz>
Date: Mon, 10 Mar 2025 11:57:52 +0100
Subject: [PATCH] mm: Fix the flipped condition in gfpflags_allow_spinning()

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>
---
 include/linux/gfp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

 #ifdef CONFIG_HIGHMEM
--
2.48.1
diff mbox series

Patch

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);
 }