Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4031413ybl; Mon, 3 Feb 2020 11:11:41 -0800 (PST) X-Google-Smtp-Source: APXvYqz7c7N1rW7oDnwer2PQilmSiaVcDVxBVt+rZ+oLH4I/njdsO6VghLMTpwib8/JPeR8ZVZr0 X-Received: by 2002:aca:ec13:: with SMTP id k19mr387284oih.22.1580757101117; Mon, 03 Feb 2020 11:11:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580757101; cv=none; d=google.com; s=arc-20160816; b=LNVY0J/dlD6cPigilCV1mHojU12m2+rxYE5pPhZza15EUDvc6joVcYrk259C1wWsOh Hv/anVVBfZJk9qyWSAaAAQpBug7bQjfEAWvW/KkLhVVmNe18DbaqwXeOcR1gy9buH9cm 78Ucbh0JmRqE+Y+56Zt2D1JNy7rizMeC5J6uxxHLec+X3+YjJ6gHWoRmBXhzjwQseCr1 JySalbV3C7uKzNHSQEsgbUSZHoCaEspTBQVaVXHRW94BAXBxYjmmk/oaHBya6yxoFq51 JuQ6Fw0WxJMGaPBOfiIryHtjkWd+ZJzrHOLdN2uYNr35pVShAbUFJD7z7qM9Zl87K817 xGbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=DnqDfzZOP8Wk1acgjZzz1PM0k7XDfNwpc8E6dw5Xd/A=; b=SPVT2H3s9rvg/54GTNWwfE3UOm7fliBt9NKOirmrtqx2FZ/oENiI/nVgmUpqDlLI2J 2FcuEOlBHop2GWhT4zTrL61dBKuxnPN4beNEef1EJIAEZtasLNzXrwuPxHW6ZYnAEN9d 5X88ADImaWWvJKnVAp9NjOq+1WYCOGiS6eXzJLG5P/h2+TWpPR+jjyE1Mu0VspbT4d40 EsaU6jmGIXv4Ub/H40iUvv2qmyZANKVkXdDFAmDo4tAQlgRYI7ywS8yMvFk8ekTjeNnP gMApCeiKbeuiY4SULjO8cjzxLeeahYocFLJVHYARgajf/vjkZh3mLe2ebIem8k1KIIjM MRQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=aSZjpZyx; 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 w197si8633383oia.101.2020.02.03.11.11.28; Mon, 03 Feb 2020 11:11:41 -0800 (PST) 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=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=aSZjpZyx; 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 S1728705AbgBCRmK (ORCPT + 98 others); Mon, 3 Feb 2020 12:42:10 -0500 Received: from mail-qt1-f194.google.com ([209.85.160.194]:33105 "EHLO mail-qt1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727198AbgBCRmJ (ORCPT ); Mon, 3 Feb 2020 12:42:09 -0500 Received: by mail-qt1-f194.google.com with SMTP id d5so12130099qto.0 for ; Mon, 03 Feb 2020 09:42:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DnqDfzZOP8Wk1acgjZzz1PM0k7XDfNwpc8E6dw5Xd/A=; b=aSZjpZyxvhUaYrerYRx7KTmQ+HXipJMmxMVJCuMZp0/ySh0wMOW3RcN4S5843cbgJ4 KXmvCMexX3j7dPqPK759dur6NCW66uaZpnz+mZN8hL3Nc/45XqCE4fgeOiUVTjJMfatU +GhNJxHYApLaL4HU98JgJ2B+Sgy5OyPIGFhaQAz81ZZyGBTGRTGwuul0jEhZZ4ampBlg zBPg3dFLHkdXvXM4VegKWWtVz0TgxCVfjQk82AoveKA7ImBJX6OaBLKENbZ3NQ3xM/46 gNCxhEfTnTq2er2cAibUoOL35v+elnwQW+37UDyIb8jArmjmQ1PMnLdjXLEn8cE6gDAV kGug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DnqDfzZOP8Wk1acgjZzz1PM0k7XDfNwpc8E6dw5Xd/A=; b=IlWqpJstF+toNYjLGeMCcstpvCqm9S0gar+eLDYY7VMKi/KbLL8cPua24riEzPUEK1 hVw2VRcXH88smS0yoQM45Q4MVARL4Z0NyvmNXhs6vGne6h/aRq7hmXr/bMnfTiHbeujG X9BMhSNkdRRc9R4Zfx6NNQLWSygLdWZ2JI//qSykdL1W1A3Pm3WYUkqzHiHXLwVaMxDZ e2waGLiXpcIgGGGmbVOhbbNNMA7EQd7sObxD6/fynInUifh+ICq8xzRmiVPnbfNHz5N1 4uTUOd0+shatJmnbDigT5IMtJ34adULxowXQTqsBp3eX99sU/OkerS/adJ/xMWW7V6MH I2UA== X-Gm-Message-State: APjAAAVTz07raToWXg27fpXcaZZNtaZlgQ/TRQq1YD71DeZtpsqNpu06 q6TQFE9yqmeemYI07IPOuHUm3aB2Yt4= X-Received: by 2002:ac8:47cc:: with SMTP id d12mr24999145qtr.246.1580751728806; Mon, 03 Feb 2020 09:42:08 -0800 (PST) Received: from localhost ([163.114.130.128]) by smtp.gmail.com with ESMTPSA id o17sm10136378qtq.93.2020.02.03.09.42.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2020 09:42:08 -0800 (PST) Date: Mon, 3 Feb 2020 12:39:58 -0500 From: Johannes Weiner To: Roman Gushchin Cc: linux-mm@kvack.org, Andrew Morton , Michal Hocko , Shakeel Butt , Vladimir Davydov , linux-kernel@vger.kernel.org, kernel-team@fb.com, Bharata B Rao , Yafang Shao Subject: Re: [PATCH v2 10/28] mm: memcg: introduce mod_lruvec_memcg_state() Message-ID: <20200203173958.GD1697@cmpxchg.org> References: <20200127173453.2089565-1-guro@fb.com> <20200127173453.2089565-11-guro@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200127173453.2089565-11-guro@fb.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 27, 2020 at 09:34:35AM -0800, Roman Gushchin wrote: > To prepare for per-object accounting of slab objects, let's introduce > __mod_lruvec_memcg_state() and mod_lruvec_memcg_state() helpers, > which are similar to mod_lruvec_state(), but do not update global > node counters, only lruvec and per-cgroup. > > It's necessary because soon node slab counters will be used for > accounting of all memory used by slab pages, however on memcg level > only the actually used memory will be counted. The free space will be > shared between all cgroups, so it can't be accounted to any > specific cgroup. Makes perfect sense. However, I think the existing mod_lruvec_state() has a bad and misleading name, and adding to it in the same style makes things worse. Can we instead rename lruvec_state to node_memcg_state to capture that it changes all levels. And then do the following, clean API? - node_state for node only - memcg_state for memcg only - lruvec_state for lruvec only - node_memcg_state convenience wrapper to change node, memcg, lruvec counters You can then open-code the disjunct node and memcg+lruvec counters. [ Granted, lruvec counters are never modified on their own - always in conjunction with the memcg counters. And frankly, the only memcg counters that are modified *without* the lruvec counter-part are the special-case MEMCG_ counters. It would be nice to have 1) a completely separate API for the MEMCG_ counters; and then 2) the node API for node and 3) a cgroup API for memcg+lruvec VM stat counters that allow you to easily do the disjunct accounting for slab memory. But I can't think of poignant names for these. At least nothing that would be better than separate memcg_state and lruvec_state calls. ]