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 9CDB3C433E0 for ; Thu, 4 Feb 2021 16:45:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5D9ED64F43 for ; Thu, 4 Feb 2021 16:45:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238025AbhBDQpV (ORCPT ); Thu, 4 Feb 2021 11:45:21 -0500 Received: from mx2.suse.de ([195.135.220.15]:40810 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238019AbhBDQnL (ORCPT ); Thu, 4 Feb 2021 11:43:11 -0500 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michal Hocko Subject: Re: [PATCH 4/7] cgroup: rstat: support cgroup1 Date: Thu, 4 Feb 2021 17:42:23 +0100 Message-ID: References: <20210202184746.119084-1-hannes@cmpxchg.org> <20210202184746.119084-5-hannes@cmpxchg.org> Mime-Version: 1.0 Return-path: 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= Content-Disposition: inline In-Reply-To: List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Johannes Weiner Cc: Andrew Morton , Tejun Heo , Roman Gushchin , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-team-b10kYP2dOMg@public.gmane.org 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-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.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