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=-5.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 74878C433E0 for ; Thu, 4 Feb 2021 16:42:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F136C64DF5 for ; Thu, 4 Feb 2021 16:42:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F136C64DF5 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 640976B006E; Thu, 4 Feb 2021 11:42:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C8836B0072; Thu, 4 Feb 2021 11:42:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4911F6B0075; Thu, 4 Feb 2021 11:42:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0064.hostedemail.com [216.40.44.64]) by kanga.kvack.org (Postfix) with ESMTP id 2CC296B006E for ; Thu, 4 Feb 2021 11:42:26 -0500 (EST) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id EA51B1EF1 for ; Thu, 4 Feb 2021 16:42:25 +0000 (UTC) X-FDA: 77781153450.13.room92_2b03301275dd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin13.hostedemail.com (Postfix) with ESMTP id CC1E618140B60 for ; Thu, 4 Feb 2021 16:42:25 +0000 (UTC) X-HE-Tag: room92_2b03301275dd X-Filterd-Recvd-Size: 3817 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf27.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 16:42:25 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1612456944; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=wsgw8MnfsGuS5yxbjBVn1LDBc6ZqPnfi34fb3SCAx6k=; b=NgWdQMlyE3luXm8XWKjVOe9zxEg7WQv8SecLlF4cS78MHz5/hEi4X7DpQCw0sW1QSTz4hN nktjmzFeN8/ZAV74ArRlOObu1QFbDkAvWW+gvQ0q7FaQ1W8UipbvtGwvyayYl/wCbxfbkn Sjl3ubKHaA2GT9ueS1b9xCOOoCMP6GU= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id E8941ABD5; Thu, 4 Feb 2021 16:42:23 +0000 (UTC) Date: Thu, 4 Feb 2021 17:42:23 +0100 From: Michal Hocko To: Johannes Weiner 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 04-02-21 11:01:30, Johannes Weiner wrote: > 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; > } Ohh, right! I have completely forgot it hit the Linus tree. -- Michal Hocko SUSE Labs