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=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_IN_DEF_DKIM_WL autolearn=ham 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 667EAC433E0 for ; Fri, 5 Feb 2021 22:11:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E5E3E64D87 for ; Fri, 5 Feb 2021 22:11:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E5E3E64D87 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4979F6B0006; Fri, 5 Feb 2021 17:11:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 447EC6B006C; Fri, 5 Feb 2021 17:11:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 35D906B006E; Fri, 5 Feb 2021 17:11:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0139.hostedemail.com [216.40.44.139]) by kanga.kvack.org (Postfix) with ESMTP id 20BA76B0006 for ; Fri, 5 Feb 2021 17:11:27 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id DC85C180AD830 for ; Fri, 5 Feb 2021 22:11:26 +0000 (UTC) X-FDA: 77785611372.27.low92_2909465275e8 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id A48AF3D66D for ; Fri, 5 Feb 2021 22:11:26 +0000 (UTC) X-HE-Tag: low92_2909465275e8 X-Filterd-Recvd-Size: 4253 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) by imf28.hostedemail.com (Postfix) with ESMTP for ; Fri, 5 Feb 2021 22:11:26 +0000 (UTC) Received: by mail-lj1-f182.google.com with SMTP id t8so9541128ljk.10 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=gPqb9lwoLbLAc7XePt5Gz6d+pUEYktSxXgt//ANlrSmzB0+iZ0avgcD/NeEic0C0up YJvoyS9MM/h2H300YaoJzzjiwez02O3HQhAT/9ZU7vMYFYh4txib7eAX7GqshsYLJPNn r3CbG4PbGcW1XftRHw3vcILzjBSI5M2ePo6rvkhrONvT2Kgih7gKBTOwdLWki9J4b2Z5 fWNrGshyezLfvF86arvD9CjFs9XmzF1gqpdSx2Us00x98fR9lsDr0kaAwn4SGjlMGnP7 +ObpNGqO0m5UL/rQiPMuy9WP0qjbepFzc+RqqKY6Mqu4w08m0xbZo03YTd6zJS6P05a/ sxIg== X-Gm-Message-State: AOAM531kJjjzOoYW9ctVKIT93+LDlbcM7f9ulKb89/MZwdqCf9lGH4cq qFzmU9kZaB64XrNQDFQ4wB/4Hp6JQvJRhL4eiRHgIw== X-Google-Smtp-Source: ABdhPJwFONDOLDANaesx5u6Fdzy4/2gaSfHlVUX6IQVv6mnSIErvIy9Bpy5BdfJbA4zstHKJUlrtR5M0E1dH2R0PW0I= 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" 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 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