From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 902596B000C for ; Thu, 26 Jul 2018 04:19:50 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id c2-v6so494436edi.20 for ; Thu, 26 Jul 2018 01:19:50 -0700 (PDT) Received: from mx1.suse.de (mx2.suse.de. [195.135.220.15]) by mx.google.com with ESMTPS id m13-v6si837089edd.103.2018.07.26.01.19.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Jul 2018 01:19:49 -0700 (PDT) Date: Thu, 26 Jul 2018 10:19:47 +0200 From: Michal Hocko Subject: Re: Showing /sys/fs/cgroup/memory/memory.stat very slow on some machines Message-ID: <20180726081947.GA28386@dhcp22.suse.cz> References: <20180717212307.d6803a3b0bbfeb32479c1e26@linux-foundation.org> <20180718104230.GC1431@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: owner-linux-mm@kvack.org List-ID: To: Bruce Merry Cc: "Singh, Balbir" , Shakeel Butt , Andrew Morton , LKML , Linux MM , Johannes Weiner , Vladimir Davydov On Thu 26-07-18 08:41:35, Bruce Merry wrote: > On 26 July 2018 at 02:55, Singh, Balbir wrote: > > Do you by any chance have use_hierarch=1? memcg_stat_show should just rely on counters inside the memory cgroup and the the LRU sizes for each node. > > Yes, /sys/fs/cgroup/memory/memory.use_hierarchy is 1. I assume systemd > is doing that. And this is actually good. Non hierarchical behavior is discouraged. The real problem is that we are keeping way too many zombie memcgs around and waiting for memory pressure to reclaim them and so they go away on their own. As I've tried to explain in other email force_empty before removing the memcg should help. Fixing this properly would require quite some heavy lifting AFAICS. We would basically have to move zombies out of the way which is not hard but we do not want to hide their current memory consumption so we would have to somehow move their stats to the parent. And then we are back to reparenting which has been removed by b2052564e66d ("mm: memcontrol: continue cache reclaim from offlined groups"). -- Michal Hocko SUSE Labs