提交 fe673ccf 编写于 作者: X Xu Yu

alinux: mm, memcg: adjust the latency probe point for memcg direct reclaim

to #26424368

Since there are features other than memcg direct reclaim which also
invoke try_to_free_mem_cgroup_pages, such as zombie memcg reaper, memcg
kswapd, etc,.  Move the latency probe point for memcg direct reclaim
from function try_to_free_mem_cgroup_pages to function try_charge, in
order to distinguish memcg direct reclaim.
Signed-off-by: NXu Yu <xuyu@linux.alibaba.com>
Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
上级 837e53ab
......@@ -2544,6 +2544,7 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
bool drained = false;
bool oomed = false;
enum oom_status oom_status;
u64 start;
if (mem_cgroup_is_root(memcg))
return 0;
......@@ -2603,8 +2604,11 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask,
memcg_memory_event(mem_over_limit, MEMCG_MAX);
start = ktime_get_ns();
nr_reclaimed = try_to_free_mem_cgroup_pages(mem_over_limit, nr_pages,
gfp_mask, may_swap);
memcg_lat_stat_update(MEM_LAT_MEMCG_DIRECT_RECLAIM,
(ktime_get_ns() - start));
if (mem_cgroup_margin(mem_over_limit) >= nr_pages)
goto retry;
......
......@@ -3454,7 +3454,6 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
unsigned long pflags;
int nid;
unsigned int noreclaim_flag;
u64 start;
struct scan_control sc = {
.nr_to_reclaim = max(nr_pages, SWAP_CLUSTER_MAX),
.gfp_mask = (current_gfp_context(gfp_mask) & GFP_RECLAIM_MASK) |
......@@ -3482,14 +3481,11 @@ unsigned long try_to_free_mem_cgroup_pages(struct mem_cgroup *memcg,
sc.reclaim_idx);
psi_memstall_enter(&pflags);
start = ktime_get_ns();
noreclaim_flag = memalloc_noreclaim_save();
nr_reclaimed = do_try_to_free_pages(zonelist, &sc);
memalloc_noreclaim_restore(noreclaim_flag);
memcg_lat_stat_update(MEM_LAT_MEMCG_DIRECT_RECLAIM,
(ktime_get_ns() - start));
psi_memstall_leave(&pflags);
trace_mm_vmscan_memcg_reclaim_end(nr_reclaimed);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册