Received: by 10.213.65.68 with SMTP id h4csp789595imn; Wed, 4 Apr 2018 07:18:52 -0700 (PDT) X-Google-Smtp-Source: AIpwx49Vi4aSXdJvjD2OZHyBnrnezHHs+UQbYNXxiXdNu2XeJvj8jVMP7XfNgMhxmt8gUGnt+N1r X-Received: by 10.98.7.152 with SMTP id 24mr9438303pfh.94.1522851532003; Wed, 04 Apr 2018 07:18:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522851531; cv=none; d=google.com; s=arc-20160816; b=chAthhc/e40NgpJKRd7UVp0jSuzo6GoMvkul2re91TYmbO5SLHHlOG0LO6g7pgNZgF SXAV4UZ/nEOyCmlULVqr/FilMQwQmxiBkgDFkD+gpvlUR4Pho/2BkHm4G4oRXOZiDCc9 b5c/Mh3H4nniodyL/V2Uw6BS9FZuqxu3OoJ9NQEoFMokWCeNDsrZprNkTUoJwPYJtLrc vkJE/vvW0S8IdJ+q0vQy4Zc1NGaa1IrCx8KZfyVtWvonujwhMVxGRwsPvbUI6koFttfv 0eblEV5NUxVEDoKatJqCszeXrbr/0WfmSo4K8+t9CMIpuULP7u6JFb8IiLkDp3ICGnLa EuTg== 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:dkim-signature:arc-authentication-results; bh=Mjnc2QxCQfVwZOSJcZSR3xq/zHEu+b/sXGTJ01/sN2s=; b=F+eZl19sBBgO6FZT/GluF6xfdK3Syt4lbIve5IH6sxEtQ6/n7x9uVuiF5Z3Mi+dhdG zyR0gZxJd5F5+wJ4gVHMkvpCuGd6fNq9mVo65aYT+j3V2Auo8kyJwC0T/O8XXoq4XtC8 gLEt1Lte8H5rlMKoJLfUNaDduW/PKmVLPYnnxoG8GvaSOReKzwfONnNnJaRx6+DYqOV2 p9dWY3hVH0UHt5yOU9InRtRkwjXQY0tpfVqOl72l8iJmPOjVu65ecgr5QFzEkF5fnslu ay7fIlU3+DF3CQ6ApHeQT+CUZloWCSupl2bqIB47yrTM5yaFO3Gd1ejELXlrjdI5ZcO6 6yFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@cmpxchg.org header.s=x header.b=v9IoPJMu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s15-v6si3529075plj.701.2018.04.04.07.18.37; Wed, 04 Apr 2018 07:18:51 -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; dkim=fail header.i=@cmpxchg.org header.s=x header.b=v9IoPJMu; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cmpxchg.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbeDDORd (ORCPT + 99 others); Wed, 4 Apr 2018 10:17:33 -0400 Received: from gum.cmpxchg.org ([85.214.110.215]:50000 "EHLO gum.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750853AbeDDORc (ORCPT ); Wed, 4 Apr 2018 10:17:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=cmpxchg.org ; s=x; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject: Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Mjnc2QxCQfVwZOSJcZSR3xq/zHEu+b/sXGTJ01/sN2s=; b=v9IoPJMuZ5qItKLD62uGK3Ezmc 93uAlx5KOxiyNL28qDk1ZBsjIyTKUNVsPy0nCuj3NSV1ySPQuz0GTjgtRCub8W7x0HCPKYyFhKoW/ F3lRcBwsi+9UyUPSEPyd3lcDO3K1qJTMFiSRCQ/2YQXNFBSBfyUzCPsc7MYmKCWHEB7I=; Date: Wed, 4 Apr 2018 10:18:50 -0400 From: Johannes Weiner To: Tejun Heo Cc: mhocko@kernel.org, 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: <20180404141850.GC28966@cmpxchg.org> References: <20180324160901.512135-1-tj@kernel.org> <20180324160901.512135-2-tj@kernel.org> <20180404140855.GA28966@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180404140855.GA28966@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, 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.