Received: by 10.213.65.68 with SMTP id h4csp807040imn; Wed, 4 Apr 2018 07:36:22 -0700 (PDT) X-Google-Smtp-Source: AIpwx49/OouMMcorhO0kIjE5mADgvTZ/B7FU9EPXmVmgKaxVaxIy61f53kvN1GQIsi6CuJVMBC1Y X-Received: by 10.98.185.15 with SMTP id z15mr6512018pfe.199.1522852582381; Wed, 04 Apr 2018 07:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522852582; cv=none; d=google.com; s=arc-20160816; b=RcKE4l2FeVUWty6HHD22t3Y6AsRyzOnN6KEnHnFpmeLJYkv3gIkpenuRTWpI0BYNlz OyrzciCLd+5BlJEEvHU2edYWwD6MByOZpgHHNBqdCl4wZciNAbGQnA8W4bCmby81OZYH q41Q6P9YV/cm4Tr2QZxFLUoxThdlt6Cv+sFj3csdL3VUmZImd5uhIdvGCPzCHDE6GVLS FdWoDnb6skBWJcRp/2T0hF8A33s/Z7HiGla89ZqMacrvIt3dejCt6buj6pSKgFFu3imJ rM3pJMVHShvctvuoQCS+LjpeS599Je+oJF1CLdTEIBQm7OzpXQzzLOjHpnwq4dDHAzVT 6/ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=ez8oHkwtMPYbLgrndyDG6TSaf1zBhJ8zY2JaSmspNIs=; b=c2v1C3m6C0JRKxWY0fUyWbjjSHHUyeODrfKEMAXNfiEpEao3HwFuTHWrn+zE7s8l6l hXsANIa8MZDvijrZvkFRlkrXq1txOG32tT9RQlQyuXt/7GIv0VSeBdpJHfrYzL8njuMS gMdfOtvqFXe8biw8otKkId0kBlVAtm/wUoczCTAPKuuxHrpPt0u4zaCq3+Z2bEQ6N2/4 sHna8zAxKluJKDILSEF554EhtUZZiZ5MZv5UJVK+1v3gQD3aVXfZyCyiDBLV6JcfXkjB /w03ACwkPbqw5iaptLhGDA0n6z4PHNskwV/wpZDI90UL5DXocsbCBKO89nj50rTJCvJ/ IeUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q7-v6si1146714plk.129.2018.04.04.07.36.08; Wed, 04 Apr 2018 07:36:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751300AbeDDOev (ORCPT + 99 others); Wed, 4 Apr 2018 10:34:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:60947 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751167AbeDDOet (ORCPT ); Wed, 4 Apr 2018 10:34:49 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 689E2AE04; Wed, 4 Apr 2018 14:34:48 +0000 (UTC) Date: Wed, 4 Apr 2018 16:34:47 +0200 From: Michal Hocko To: Johannes Weiner Cc: Tejun Heo , vdavydov.dev@gmail.com, guro@fb.com, riel@surriel.com, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, kernel-team@fb.com, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 1/3] mm: memcontrol: Use cgroup_rstat for event accounting Message-ID: <20180404143447.GJ6312@dhcp22.suse.cz> References: <20180324160901.512135-1-tj@kernel.org> <20180324160901.512135-2-tj@kernel.org> <20180404140855.GA28966@cmpxchg.org> <20180404141850.GC28966@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180404141850.GC28966@cmpxchg.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 04-04-18 10:18:50, Johannes Weiner wrote: > On Wed, Apr 04, 2018 at 10:08:55AM -0400, Johannes Weiner wrote: > > On Sat, Mar 24, 2018 at 09:08:59AM -0700, Tejun Heo wrote: > > > @@ -91,6 +91,9 @@ struct mem_cgroup_stat_cpu { > > > unsigned long events[MEMCG_NR_EVENTS]; > > > unsigned long nr_page_events; > > > unsigned long targets[MEM_CGROUP_NTARGETS]; > > > + > > > + /* for cgroup rstat delta calculation */ > > > + unsigned long last_events[MEMCG_NR_EVENTS]; > > > }; > > > > > > struct mem_cgroup_reclaim_iter { > > > @@ -233,7 +236,11 @@ struct mem_cgroup { > > > > > > struct mem_cgroup_stat_cpu __percpu *stat_cpu; > > > atomic_long_t stat[MEMCG_NR_STAT]; > > > - atomic_long_t events[MEMCG_NR_EVENTS]; > > > + > > > + /* events is managed by cgroup rstat */ > > > + unsigned long long events[MEMCG_NR_EVENTS]; /* local */ > > > + unsigned long long tree_events[MEMCG_NR_EVENTS]; /* subtree */ > > > + unsigned long long pending_events[MEMCG_NR_EVENTS];/* propagation */ > > > > The lazy updates are neat, but I'm a little concerned at the memory > > footprint. On a 64-cpu machine for example, this adds close to 9000 > > words to struct mem_cgroup. And we really only need the accuracy for > > the 4 cgroup items in memory.events, not all VM events and stats. > > > > Why not restrict the patch to those? It would also get rid of the > > weird sharing between VM and cgroup enums. > > In fact, I wonder if we need per-cpuness for MEMCG_LOW, MEMCG_HIGH > etc. in the first place. They describe super high-level reclaim and > OOM events, so they're not nearly as hot as other VM events and > stats. We could probably just have a per-memcg array of atomics. Agreed! -- Michal Hocko SUSE Labs