Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1120129pxb; Thu, 4 Feb 2021 05:43:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJxAAATjeFn3/o12S3ZeTbLgy1Lv5F5DR2sfbGfT05AYhcR9gP8qYFTUzol2WgVsqRXtV6UN X-Received: by 2002:a50:e442:: with SMTP id e2mr8374369edm.235.1612446233630; Thu, 04 Feb 2021 05:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612446233; cv=none; d=google.com; s=arc-20160816; b=nTWcX/pIZ19go4zP4syNpV3U9U7ePpVvRk384a2aqr7SseQOcFFyMIOObjrjCMeBz9 d20HnRIYplwk6OjpjBSB55EWkfPk95xvi+mMLxg4IoMjLgfxX/unHHhNpTIiBophklCa yxWzYX2H2wnc7Bg0n+q9f6bwVGYzlLxcWDRrvJ63Z4dj5ECJx7ic8xrFuRH4FpvwPBae e0mNUpvi7CBHdOWN603iuMy5lFq8TUj5uiVCE1MutH35NbA3Mpr44AyyecRBBt/TGhaI 5etVohgUuiYHOPJbFuKHdxFkD5YpBObmNf8IBgkg1sS9NUOx4f5l2xTP0N9R3pGnRSJE LAag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=H0iQZN9iBmT3QwxhzQGnFSuWS/L+fw1WcnDMqXjE4sk=; b=EkNpqtOvK9qpig+CFHlm5emCBbVWRk0aDVAYLKnU7U3Pn3PBcjMVAg6YNpoHE5b5PI e5vXSXg1RQ4PFwXwleVEqaj1kmlixEJYC/7MvTLzedcfNEz4YWx4n76tT7IYavL6oT+O +YQ8X4fbB6RCfDoFYJJqqlq3Cl7jJyhOzQZjf9QacvKDWJDrQzz2Btkdlz+RtpOeLgEy 0yvFbr+yk5qPFmvDbIyt7nE7atLoOInAr+OVzsQxb5QAJOhb2pcMWJefPr/KYjhO5wA7 EnWjhcAK+T+sSH61aFQiLm/zYu/yBsvVun1bhqNR5buM31OcWpY6TClc3dJSRp7nIpi5 nQpQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=mlbFQKAj; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si3310669edk.387.2021.02.04.05.43.28; Thu, 04 Feb 2021 05:43:53 -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=@suse.com header.s=susede1 header.b=mlbFQKAj; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236276AbhBDNl1 (ORCPT + 99 others); Thu, 4 Feb 2021 08:41:27 -0500 Received: from mx2.suse.de ([195.135.220.15]:54716 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236391AbhBDNkO (ORCPT ); Thu, 4 Feb 2021 08:40:14 -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=1612445966; 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=H0iQZN9iBmT3QwxhzQGnFSuWS/L+fw1WcnDMqXjE4sk=; b=mlbFQKAjZNJBkGo4WGSDEqnrJ5Pl4vQ0Xceo5aT+AhaeGPnRgitRceRm3Nthy4aoSRqWhx 23qF+PYgNK2ZNRMB2Y797rPr3jkRB7IAyUY2ldM+JEzuhz+2nLuHMPVmtl/st6Ly3gM6CS qXNuDRYyjC0oT8jpFxizSuPAOV/dYfA= Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1AD66AF24; Thu, 4 Feb 2021 13:39:26 +0000 (UTC) Date: Thu, 4 Feb 2021 14:39:25 +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: <20210202184746.119084-5-hannes@cmpxchg.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Michal Hocko SUSE Labs