Skip to content

Commit

Permalink
memcg: replace in_interrupt() with !in_task()
Browse files Browse the repository at this point in the history
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/[email protected]
Signed-off-by: Shakeel Butt <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Vasily Averin <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: Roman Gushchin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
shakeelb authored and torvalds committed Mar 22, 2022
1 parent 4bfa8ad commit 086f694
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mm/memcontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -2688,7 +2688,7 @@ static int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
READ_ONCE(memcg->swap.high);

/* Don't bother a random interrupted task */
if (in_interrupt()) {
if (!in_task()) {
if (mem_high) {
schedule_work(&memcg->high_work);
break;
Expand Down Expand Up @@ -6968,7 +6968,7 @@ void mem_cgroup_sk_alloc(struct sock *sk)
return;

/* Do not associate the sock with unrelated interrupted task's memcg. */
if (in_interrupt())
if (!in_task())
return;

rcu_read_lock();
Expand Down

0 comments on commit 086f694

Please sign in to comment.