From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 088B7C433DB for ; Thu, 4 Feb 2021 16:01:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 711D364F4E for ; Thu, 4 Feb 2021 16:01:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 711D364F4E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=cmpxchg.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id C9DB26B006E; Thu, 4 Feb 2021 11:01:34 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4FFA6B0080; Thu, 4 Feb 2021 11:01:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B659D6B0081; Thu, 4 Feb 2021 11:01:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0217.hostedemail.com [216.40.44.217]) by kanga.kvack.org (Postfix) with ESMTP id 9F4526B006E for ; Thu, 4 Feb 2021 11:01:34 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 6001A8249980 for ; Thu, 4 Feb 2021 16:01:34 +0000 (UTC) X-FDA: 77781050508.10.badge41_2a02e3c275dd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin10.hostedemail.com (Postfix) with ESMTP id D91CB16A4B1 for ; Thu, 4 Feb 2021 16:01:33 +0000 (UTC) X-HE-Tag: badge41_2a02e3c275dd X-Filterd-Recvd-Size: 5071 Received: from mail-qk1-f177.google.com (mail-qk1-f177.google.com [209.85.222.177]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 16:01:33 +0000 (UTC) Received: by mail-qk1-f177.google.com with SMTP id k193so3753925qke.6 for ; Thu, 04 Feb 2021 08:01:32 -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=R+LsT+N5x92Igsnql8HsCFDhUNRHROtREV0v0MwUOes6tpcdeZWUBmI14l6xZj56/g VLNbj6wMZ7JzHj3c8cO/bg6yXjyy26otXMk92iqefDCsq0YysPsICH5WNFV9+uvAeebM e3h+tmRNZcS1LM5rbv4BR3n1mZNxswcE1fy4psM13/rwE8lj0Wzw3GNfaKFEkBIQWa1w SYhXknH8xtLDsdqhvS7zCTPnb7oVEJFR9rVekTLKOcjOlBVSmrOCSjnc2x4ayVoF86um 9GCdjO+WhcbhkgfJzEFd6z8hEF8PT4Hd775w+Gx3eXIiUId/Z+Zlcnu2B/HndnBN3BW2 PQ7Q== X-Gm-Message-State: AOAM531svOj2hlRp+kD6nbOjfCITbMXtReSnBqDoOwlQxFTl+eeoOv2U loe/1GdE7DpitDYsNW3tRQ70eA== X-Google-Smtp-Source: ABdhPJx32xnUx1I/2ZP4O2vFlTEG+H5002aJfu2W9Eo9vQWKWc/7ZcfPYxFwSGtfzojxNcEAaiJ5GA== 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: X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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; }