Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2446939pxb; Fri, 5 Feb 2021 19:33:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJzLuuozzPRJGEoTtDbA/5Kag7zLqRQPgJhtaF7o6ClqFcFUUWFdb6qc1bsALsf6qLuFgVJH X-Received: by 2002:a05:6402:1398:: with SMTP id b24mr6390408edv.108.1612582380390; Fri, 05 Feb 2021 19:33:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612582380; cv=none; d=google.com; s=arc-20160816; b=HvHP1THCFZx3jeZtR4Qpb0zCdOIuQIV9MCcKylRqY8F7xYuAvIQgkwqB1y6IxoXVDT 56QT5ikvvakg49Zi/YxxL0MZ6XrcZMSm8rYG+RevNKwhkYeeriRU+Yw5ha7iR6+PD+ty co8CKGlpPJYSrE+FNKAvkbPKvQIcaUaadxLDaoJbgfwqetfTwH7/YNNCH6FhbpTN/Nmq K9e02uh7Q/CJHyMZILl7pEcRj7CI92I/TMHZ1E7o2CTpAAAPgdk6x/hJKKnRhH8hpw79 kpJnkc0f0cXYJzhxlvzCWa83xJ5MKveqSETZFmdeuY+ze2qcyzNAD33DLi09mjjma0Ts Ru+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/4qEkNOrLEa6lxN/95STT61avrFjfvYnDY/MmP9s+0o=; b=zNGPgwkmwNpazmiCfGzsFZHzTfyDfah5XVtEit6vqVCJK/6wbxJCEZnP0MdyUmXqVn oktbzAbolmteZKsksV0Eu8y5rxum1wxjhSbzwQwgtQYRKt9s3IMv9X5sucdNja5miNen FPVdDoryTj9Hu0biXMhIWODNjZl8wKiDfRIpRQEelrsZ0Ld8PVLM9fWeMW3JuIbmxIqT ZWYzw4Po4x/P2fO/3mYUR7QqXPgO/ZNtogUCkf4cTjspUTz5DWUVTl+PSqHPcL32kwZt /cG9SqpBK3NIpX3HViD6yeuWdaIRKqDA1VRq1tNiCKjYpfRuNisdZXGjBc5BDZWa2Q+0 VHYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="SFMRg/15"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id jx12si6539406ejb.247.2021.02.05.19.32.36; Fri, 05 Feb 2021 19:33:00 -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=@google.com header.s=20161025 header.b="SFMRg/15"; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232000AbhBFDbx (ORCPT + 99 others); Fri, 5 Feb 2021 22:31:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231610AbhBFClF (ORCPT ); Fri, 5 Feb 2021 21:41:05 -0500 Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 419DDC061D7E for ; Fri, 5 Feb 2021 14:11:26 -0800 (PST) Received: by mail-lj1-x229.google.com with SMTP id f2so9543797ljp.11 for ; Fri, 05 Feb 2021 14:11:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/4qEkNOrLEa6lxN/95STT61avrFjfvYnDY/MmP9s+0o=; b=SFMRg/15SplEen1Sye0qlnbdi+BfK5VijvW5vUJ3y4Bmd4WNJhz6tl0srP2+1DuSsw C3lWkUPurWOVp2t0RFiov09RInfN7R/g5i+K4WwL4uTDcMOdhpN9CeSp801NpEtNOBEC SUdZb4605uhwR5bxZZ2IVZ3+ObmydPjYJuSCzxaXilJ1YgjkzpbLxmNch2OjtoJfI10g USfaUm4N8916uETHmf91lTR6yn2JpFCCrQuufBqk+FfCam5Z/XPbN5uKx99d7R/QHtcn sP15nQFOITOtaQ/eAIvwbrPPeGrV1BcVQa5PrUgUWKGhSDaW5yOE5xD6ccRkRVR1ZMNi ue2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/4qEkNOrLEa6lxN/95STT61avrFjfvYnDY/MmP9s+0o=; b=JGNy9Puro8U4Wypak8T1AYiC3U4b5yWUi6ErEDTIpACu0C7ansuKf1bugFAgp7jrBx BUITWmC4YR59Z81DbfL8eAd1AaPyOHgBQ/sFk58QLq+IjHSncB/qDR5CGhg2HJ0Kx6xi t6MlENjdadQlKiqUr5XbBFnToBFWhTqdPrsSvZpyXf1GgSB6mS5USHkhLqRv/xajLJ1S tagNDYzh/uXzDMLg+wUos2t7Me72sSxtcvhHGTC14S3l6RYpVSMjQqhFvqmFoDwosZSb ltmw1SgXXJvPClY7/Mr2lwuN0MhJBwWm+h1rw14YEKA+qxV35f2TaKmYfheK/9RIVlX2 MpjA== X-Gm-Message-State: AOAM532dzugR/lxn0+YzCbGejNgMWvgjSbP3iDNuEuaIvoYBLApZY2e+ 8r7DEWiOa3n8S/4vSb87cDshFBE2EOnKVgV2iNrn1A== X-Received: by 2002:a2e:9ed1:: with SMTP id h17mr3702229ljk.160.1612563084463; Fri, 05 Feb 2021 14:11:24 -0800 (PST) MIME-Version: 1.0 References: <20210205182806.17220-1-hannes@cmpxchg.org> <20210205182806.17220-5-hannes@cmpxchg.org> In-Reply-To: <20210205182806.17220-5-hannes@cmpxchg.org> From: Shakeel Butt Date: Fri, 5 Feb 2021 14:11:13 -0800 Message-ID: Subject: Re: [PATCH 4/8] cgroup: rstat: support cgroup1 To: Johannes Weiner Cc: Andrew Morton , Tejun Heo , Michal Hocko , Roman Gushchin , Linux MM , Cgroups , LKML , Kernel Team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 5, 2021 at 10:28 AM 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. > > Signed-off-by: Johannes Weiner > Reviewed-by: Roman Gushchin Reviewed-by: Shakeel Butt