Skip to content

Commit 086f694

Browse files
shakeelbtorvalds
authored andcommitted
memcg: replace in_interrupt() with !in_task()
Replace the deprecated in_interrupt() with !in_task() because in_interrupt() returns true for BH disabled even if the call happens in the task context. in_task() is the right interface to differentiate task context from NMI, hard IRQ and softirq contexts. Link: https://lkml.kernel.org/r/20220127162636.3461256-1-shakeelb@google.com Signed-off-by: Shakeel Butt <shakeelb@google.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Vasily Averin <vvs@virtuozzo.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Roman Gushchin <roman.gushchin@linux.dev> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4bfa8ad commit 086f694

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mm/memcontrol.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,7 +2688,7 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
26882688
READ_ONCE(memcg->swap.high);
26892689

26902690
/* Don't bother a random interrupted task */
2691-
if (in_interrupt()) {
2691+
if (!in_task()) {
26922692
if (mem_high) {
26932693
schedule_work(&memcg->high_work);
26942694
break;
@@ -6968,7 +6968,7 @@ void mem_cgroup_sk_alloc(struct sock *sk)
69686968
return;
69696969

69706970
/* Do not associate the sock with unrelated interrupted task's memcg. */
6971-
if (in_interrupt())
6971+
if (!in_task())
69726972
return;
69736973

69746974
rcu_read_lock();

0 commit comments

Comments
 (0)