Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1239222pxb; Thu, 4 Feb 2021 08:08:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzGPrKQZeWiqS7OZLYzWVFG2dHS1Am6eL04M7x/TIUINYzeVP92LC0bC91NPsztUWKN9X0d X-Received: by 2002:a17:906:38c3:: with SMTP id r3mr8750344ejd.193.1612454933792; Thu, 04 Feb 2021 08:08:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612454933; cv=none; d=google.com; s=arc-20160816; b=S83gq6Yt3sU13vUN3KcEOyF9xEDg7iiM9kxBNpciTPEUWBQmBWq83bB2b30lyD5MgQ 2sAh1mXnDA7oMHKyZ+9puASfhyCNx2RE093ZYA6AXp9Gf0o/DHrznHNQaLu9wWGlnyjk z/AUCsPmg0RSY6kPhGBFIValFZx97u63xqiTprEzumYzYRb8UEkc/9VhnP2zwlVIoqfp 8ZGltPeR5u65z+FHtSOeV2KESlv/fEHMlLHP9zUqf5xTnApWcilaQSUEhxOIJq7ubiMp 6eMyhlwm+MgFOwMEe02G8MpbRQT5JZtk1ujy++Kw8g83s1zGgXxIRaHSRSZZgUCO8P4C eQ1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=csnC8vI9T1wPkKdVnk2T3EegCaTzDUoDkg3RtcvUQt0=; b=SqNSbdz9Rm7FucwH7R35U8+Jl91Nu5dw/rDIaR3O5U2QROisBglBfRjrGIbHroKPi4 RPu4G63tZNZBAGvc9r9ph4/jMc2wEMFv4qFrl63ouyKLs/ur6Fv3I7AlmHxyMQO0/DQs trknSC+Sazh1rmnVPLxZtKWQTKrkEPCbiz+hQzhJqnftQ+T1suiSmzPpDki71O0hVBH7 YB9w3v5GT07jeMUJ8buuYy+zpOWJvC/xAiy/ayCSQ6FPjTv8gAb6Zl4H1PJxdyFJIU7n N3/z78kS4qKeOXJ70pAZYj3VUy/1Kpw35lJZLIAkjrTZiF5pDEqrHjkgxMyREM3sS5Be hAWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=om9bw173; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id x1si3475135eju.744.2021.02.04.08.08.27; Thu, 04 Feb 2021 08:08:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cmpxchg-org.20150623.gappssmtp.com header.s=20150623 header.b=om9bw173; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S237570AbhBDQD6 (ORCPT + 99 others); Thu, 4 Feb 2021 11:03:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237540AbhBDQCP (ORCPT ); Thu, 4 Feb 2021 11:02:15 -0500 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB190C061788 for ; Thu, 4 Feb 2021 08:01:34 -0800 (PST) Received: by mail-qk1-x72f.google.com with SMTP id k193so3754042qke.6 for ; Thu, 04 Feb 2021 08:01:34 -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=csnC8vI9T1wPkKdVnk2T3EegCaTzDUoDkg3RtcvUQt0=; b=om9bw1733wlt1/kLEgKPgVnHc/NgppIyLl3gcn5uZTxcNLNlLmm/dcW3kKnRBqJ1kP VJckPkk8IWcl+e6iyWLb/rPmCsRwzIQS4d+o6d9mYr4g8FxKPqxG4vvn7XeKENY3r0IC 1LaB5GlWS3YVKSJItCGIthyB1GthkrGXEpGx/4rzUptWXX5Y2aU8Lgrex7t0/LI3pGP6 1gP1wf3yZ/nhn2phPWvvBuYwk2vpZC78juptyfdu00sQDAHwUSXeS0vsYhIx/E2wT+CI eXV1MkmzGpbjcRrPxWdQVedLBV1Rbp1D32tSh0qqx6W0CERrvFXvU9ryGCfamlzKIAa1 2sAw== 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=csnC8vI9T1wPkKdVnk2T3EegCaTzDUoDkg3RtcvUQt0=; b=cw9oeOvDwURCUecrFGfXDQWbpOgzzCOr5DgLjvYYT1DrMXOFsFpfDUWZ6Ap1qoFewo 4fwoI8aXjViSI9HhDlV975PWh5uX8RWjJGppsnbpIIpKlptlGt+xoH6n5dLVEzKWt9Uk lgs8gEufzFKb04urmn8kH6LTHHoZO/dNnHpfHdhvWDqOo6K737PV7+xY57hmK1cRMleN zbhj5Xv6635Zwq5O3PZDIBgmCODCBPOehpjFRAsoMxlMA9xqiQRJLoFRtgb9st5e2gB4 P5yqI+DjC8vFooF6nmRYDWgYD5RAaiwmbOXq+2UaVrnG8coVuEkM4Q6WzeAnr7eWNST3 0Jjg== X-Gm-Message-State: AOAM532akxi1jv7Zw6vIKTtyGJNnMN01NWRTBpREyw/8umnngG90rjNt t8xFgfBH6FInNuYgbM+tmMetOA== X-Received: by 2002:a37:788:: with SMTP id 130mr8415601qkh.390.1612454492267; Thu, 04 Feb 2021 08:01:32 -0800 (PST) Received: from localhost (70.44.39.90.res-cmts.bus.ptd.net. [70.44.39.90]) by smtp.gmail.com with ESMTPSA id r17sm4848993qta.78.2021.02.04.08.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 08:01:30 -0800 (PST) Date: Thu, 4 Feb 2021 11:01:30 -0500 From: Johannes Weiner To: Michal Hocko Cc: Andrew Morton , Tejun Heo , Roman Gushchin , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 4/7] cgroup: rstat: support cgroup1 Message-ID: References: <20210202184746.119084-1-hannes@cmpxchg.org> <20210202184746.119084-5-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 04, 2021 at 02:39:25PM +0100, Michal Hocko wrote: > On Tue 02-02-21 13:47:43, Johannes Weiner wrote: > > Rstat currently only supports the default hierarchy in cgroup2. In > > order to replace memcg's private stats infrastructure - used in both > > cgroup1 and cgroup2 - with rstat, the latter needs to support cgroup1. > > > > The initialization and destruction callbacks for regular cgroups are > > already in place. Remove the cgroup_on_dfl() guards to handle cgroup1. > > > > The initialization of the root cgroup is currently hardcoded to only > > handle cgrp_dfl_root.cgrp. Move those callbacks to cgroup_setup_root() > > and cgroup_destroy_root() to handle the default root as well as the > > various cgroup1 roots we may set up during mounting. > > > > The linking of css to cgroups happens in code shared between cgroup1 > > and cgroup2 as well. Simply remove the cgroup_on_dfl() guard. > > > > Linkage of the root css to the root cgroup is a bit trickier: per > > default, the root css of a subsystem controller belongs to the default > > hierarchy (i.e. the cgroup2 root). When a controller is mounted in its > > cgroup1 version, the root css is stolen and moved to the cgroup1 root; > > on unmount, the css moves back to the default hierarchy. Annotate > > rebind_subsystems() to move the root css linkage along between roots. > > I am not familiar with rstat API and from this patch it is not really > clear to me how does it deal with memcg v1 use_hierarchy oddness. That's gone, right? static int mem_cgroup_hierarchy_write(struct cgroup_subsys_state *css, struct cftype *cft, u64 val) { if (val == 1) return 0; pr_warn_once("Non-hierarchical mode is deprecated. " "Please report your usecase to linux-mm@kvack.org if you " "depend on this functionality.\n"); return -EINVAL; }