linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm: avoid bothering interrupted task when charge memcg in softirq
@ 2018-07-14  8:32 Yafang Shao
  2018-07-14 15:38 ` Shakeel Butt
  2018-07-16  7:58 ` Michal Hocko
  0 siblings, 2 replies; 15+ messages in thread
From: Yafang Shao @ 2018-07-14  8:32 UTC (permalink / raw)
  To: hannes, mhocko, vdavydov.dev; +Cc: cgroups, linux-mm, linux-kernel, Yafang Shao

try_charge maybe executed in packet receive path, which is in interrupt
context.
In this situation, the 'current' is the interrupted task, which may has
no relation to the rx softirq, So it is nonsense to use 'current'.

Avoid bothering the interrupted if page_counter_try_charge failes.

Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
---
 mm/memcontrol.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 68ef266..13f95db 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2123,6 +2123,9 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
 		goto retry;
 	}
 
+	if (in_softirq())
+		goto nomem;
+
 	/*
 	 * Unlike in global OOM situations, memcg is not in a physical
 	 * memory shortage.  Allow dying and OOM-killed tasks to
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2018-07-16 11:08 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-14  8:32 [PATCH] mm: avoid bothering interrupted task when charge memcg in softirq Yafang Shao
2018-07-14 15:38 ` Shakeel Butt
2018-07-15  2:10   ` Yafang Shao
2018-07-15  2:25     ` Yafang Shao
2018-07-15  4:25     ` Shakeel Butt
2018-07-15  5:25       ` Yafang Shao
2018-07-15  6:34         ` Shakeel Butt
2018-07-15  8:01           ` Yafang Shao
2018-07-15 15:04             ` Shakeel Butt
2018-07-16  1:49               ` Yafang Shao
2018-07-16  3:09                 ` Shakeel Butt
2018-07-16  3:38                   ` Yafang Shao
2018-07-16  7:58 ` Michal Hocko
2018-07-16  9:45   ` Yafang Shao
2018-07-16 11:08     ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).