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>
This commit is contained in:
committed by
Linus Torvalds
parent
4bfa8ada80
commit
086f694a75
@@ -2688,7 +2688,7 @@ done_restock:
|
|||||||
READ_ONCE(memcg->swap.high);
|
READ_ONCE(memcg->swap.high);
|
||||||
|
|
||||||
/* Don't bother a random interrupted task */
|
/* Don't bother a random interrupted task */
|
||||||
if (in_interrupt()) {
|
if (!in_task()) {
|
||||||
if (mem_high) {
|
if (mem_high) {
|
||||||
schedule_work(&memcg->high_work);
|
schedule_work(&memcg->high_work);
|
||||||
break;
|
break;
|
||||||
@@ -6968,7 +6968,7 @@ void mem_cgroup_sk_alloc(struct sock *sk)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Do not associate the sock with unrelated interrupted task's memcg. */
|
/* Do not associate the sock with unrelated interrupted task's memcg. */
|
||||||
if (in_interrupt())
|
if (!in_task())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rcu_read_lock();
|
rcu_read_lock();
|
||||||
|
Reference in New Issue
Block a user