Re: [PATCH 1/9] memcg: accounting for allocations called with disabled BH
From: Vasily Averin <hidden>
Date: 2021-03-10 09:17:49
Also in:
linux-mm
On 3/9/21 10:39 PM, Shakeel Butt wrote:
On Tue, Mar 9, 2021 at 12:04 AM Vasily Averin [off-list ref] wrote:quoted
in_interrupt() check in memcg_kmem_bypass() is incorrect because it does not allow to account memory allocation called from task context with disabled BH, i.e. inside spin_lock_bh()/spin_unlock_bh() sections Signed-off-by: Vasily Averin <redacted>In that file in_interrupt() is used at other places too. Should we change those too?
Yes, you're right, in_interrupt() is used incorrectly in other places too, but 1) these cases are not so critical as this one, 2) and are not related to current patch set They can be replaced later without urgency (unless I missed something imporant). thank you, Vasily Averin
quoted
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 845eec0..568f2cb 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c@@ -1076,7 +1076,7 @@ static __always_inline bool memcg_kmem_bypass(void) return false; /* Memcg to charge can't be determined. */ - if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD)) + if (!in_task() || !current->mm || (current->flags & PF_KTHREAD)) return true; return false; --1.8.3.1