From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 954813358CA; Tue, 27 Jan 2026 10:08:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769508517; cv=none; b=dFzdED9D7VUKK7j/y6dCxCLTfWDTBuL2pyiB9EGSziHJhfy0VM4JvtPHB59Ep1HYIruloU179K/fHXXQaWm6kKpLiWMH4W7a812aOjY6l+Xmjx8EQp572A+zH4ly+kI+EAQhq6p9CE1KT3tBh1MXnrfF7nP/7ialKRSTjEgtoNY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769508517; c=relaxed/simple; bh=5stgSFPOFTFIULArixFeHkYV56tWc18IJxdLX0dDglY=; h=Content-Type:MIME-Version:Message-Id:In-Reply-To:References: Subject:From:To:Cc:Date; b=RPvwNuFyQPHA2NI9T4WnIMNI8lCEInCa8fkbTXmSSCl+2K3h4woM8AnEnsd/Mx1mjQSUxxOQoRZ9hQdG/bY4iGPKbDzk+IFSHYpyyuwZ1PKiC1/S7oBxwsE5HcMrdLf4aBYWPytywZi0SWw9XznEIXx9+59LKx0wDffkZ1e0czw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NV3uG0II; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NV3uG0II" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88634C116C6; Tue, 27 Jan 2026 10:08:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1769508517; bh=5stgSFPOFTFIULArixFeHkYV56tWc18IJxdLX0dDglY=; h=In-Reply-To:References:Subject:From:To:Cc:Date:From; b=NV3uG0IIJ6oSlguw1ZOHGTXtX0nknoen7oyTS8zTEgfLxcLcEXtD4qakjZdS+GRDN m/iMbO0lg+p37/K4dLa4XKE/hjJWpm7tTOpi+ndk9g64uAZDiw7gXbWFhKVHyvI7fO N9Dd9ZbQbIMC5rO1zWbIt3ZFZ1ARRxKSqZdp/SejHNvFxXCWHQl0v9TgiD9otDZ388 ypdzcpuHPEWW1mOZF60Aan+OvKkWE0pYm4UcReG1RH+fTqE9qxWp611DJfQBcShTs6 MlaGeAKzvdLhhZwxWiiTXlvTt8fD+2pcZncfLOhT9+en3swcxHqgm4KxDgl8rYJqPd 6SrdFZVC+e2Yg== Content-Type: multipart/mixed; boundary="===============4752217963743545921==" Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <6173f32708a0a1401350ac03dfeb0c3a6b212331b233b3269ff708dfc74dcffe@mail.kernel.org> In-Reply-To: References: Subject: Re: [RFC PATCH bpf-next v5 08/12] mm: memcontrol: Add BPF struct_ops for memory controller From: bot+bpf-ci@kernel.org To: hui.zhu@linux.dev,akpm@linux-foundation.org,hannes@cmpxchg.org,mhocko@kernel.org,roman.gushchin@linux.dev,shakeel.butt@linux.dev,muchun.song@linux.dev,ast@kernel.org,daniel@iogearbox.net,andrii@kernel.org,martin.lau@linux.dev,eddyz87@gmail.com,song@kernel.org,yonghong.song@linux.dev,john.fastabend@gmail.com,kpsingh@kernel.org,sdf@fomichev.me,haoluo@google.com,jolsa@kernel.org,shuah@kernel.org,peterz@infradead.org,ojeda@kernel.org,nathan@kernel.org,kees@kernel.org,tj@kernel.org,jeffxu@chromium.org,mkoutny@suse.com,kernel@jfarr.cc,brauner@kernel.org,rdunlap@infradead.org,brgerst@gmail.com,masahiroy@kernel.org,davem@davemloft.net,kuba@kernel.org,hawk@kernel.org,inwardvessel@gmail.com,willemb@google.com,kerneljasonxing@gmail.com,paul.chaignon@gmail.com,a.s.protopopov@gmail.com,ameryhung@gmail.com,chenridong@huaweicloud.com,lance.yang@linux.dev,jiayuan.chen@linux.dev,linux-kernel@vger.kernel.org,linux-mm@kvack.org,cgroups@vger.kernel.org,bpf@vger.kernel.org,netdev@vger.kernel.org,linux-kselftest@vger.kernel.org Cc: zhuhui@kylinos.cn,geliang@kernel.org,ast@kernel.org,andrii@kernel.org,daniel@iogearbox.net,martin.lau@kernel.org,eddyz87@gmail.com,yonghong.song@linux.dev,clm@meta.com,ihor.solodrai@linux.dev Date: Tue, 27 Jan 2026 10:08:36 +0000 (UTC) --===============4752217963743545921== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 1f74fce27677..8d90575aa77d 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c [ ... ] > @@ -2530,10 +2537,14 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask, > * kernel. If this is successful, the return path will see it > * when it rechecks the overage and simply bail out. > */ > - if (current->memcg_nr_pages_over_high > MEMCG_CHARGE_BATCH && > - !(current->flags & PF_MEMALLOC) && > - gfpflags_allow_blocking(gfp_mask)) > - __mem_cgroup_handle_over_high(gfp_mask); > + if (gfpflags_allow_blocking(gfp_mask)) { > + unsigned long bpf_high_delay; > + > + bpf_high_delay = bpf_memcg_get_high_delay(orig_memcg); > + if (bpf_high_delay || > + current->memcg_nr_pages_over_high > MEMCG_CHARGE_BATCH) > + __mem_cgroup_handle_over_high(gfp_mask, bpf_high_delay); > + } The old code checked !(current->flags & PF_MEMALLOC) before calling __mem_cgroup_handle_over_high(). This check appears to be missing in the new code. When PF_MEMALLOC is set, the task is already in the memory reclaim context. Calling __mem_cgroup_handle_over_high() from such a context would invoke reclaim_high() -> try_to_free_mem_cgroup_pages(), potentially causing reclaim recursion. Was the removal of the PF_MEMALLOC check intentional? If a BPF program returns a non-zero delay from get_high_delay_ms while the task is in a reclaim context, could this lead to recursive reclaim or deadlock? --- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21392729810 AI-authorship-score: low AI-authorship-explanation: The code shows typical human characteristics including a refactoring oversight that AI would likely not make; the commit follows standard kernel conventions and has multiple human authors. issues-found: 1 issue-severity-score: medium issue-severity-explanation: Missing PF_MEMALLOC check could cause memory reclaim recursion when BPF programs are attached, potentially leading to system instability. --===============4752217963743545921==--