From: Vlastimil Babka <vbabka@suse.cz>
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>
Subject: Re: [linux-next:master] [memcg] 01d37228d3: netperf.Throughput_Mbps 37.9% regression
Date: Mon, 10 Mar 2025 12:03:34 +0100 [thread overview]
Message-ID: <9d8f5f92-5f4b-4732-af48-3ecaa41af81a@suse.cz> (raw)
In-Reply-To: <CAADnVQ+g=VN6cOVzhF2ory0isXEc52W8fKx4KdwpYfOMvk372A@mail.gmail.com>
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(-)
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.48.1
prev parent reply other threads:[~2025-03-10 11:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-10 5:50 kernel test robot
2025-03-10 9:55 ` Vlastimil Babka
2025-03-10 10:18 ` Alexei Starovoitov
2025-03-10 10:34 ` Vlastimil Babka
2025-03-10 10:56 ` Alexei Starovoitov
2025-03-10 11:03 ` Vlastimil Babka [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9d8f5f92-5f4b-4732-af48-3ecaa41af81a@suse.cz \
--to=vbabka@suse.cz \
--cc=alexei.starovoitov@gmail.com \
--cc=ast@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lkp@intel.com \
--cc=mhocko@suse.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=shakeel.butt@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox