Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2459984pxb; Fri, 5 Feb 2021 20:04:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJzhg/HIOLf13t83+f5GrMTpVgugTw77lK65tdJ7lFH9vfitYibbmE/zvcamrRXN1Z48OOeq X-Received: by 2002:a17:907:724a:: with SMTP id ds10mr6882560ejc.28.1612584265863; Fri, 05 Feb 2021 20:04:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612584265; cv=none; d=google.com; s=arc-20160816; b=GXfJmk8oPQQq9lo4daRh0px4F4uLjTbf8BGDrivxHKP92uUIfEMWI1rUs9hHfd+pnw 7n2nOGYOh3ub4jcYvhpOItoJAGrS//Xf3E5XsG9CUi8rDm34RyJlg++ebFjCJ8vv217w qiHl6AEYT3HtWxwK5UzLO1QqYn3+0SBg0Q58cxcIJv8Qfs622yzHE2S43IAoqsQdSuhU YUXKcKeRuW2r5ZS3IYUY5eqIaALtFdj6ZnphUCXWtZ+ZBoXBUT01gPaGusAjqZlir8TM KsUUwOF4Y1zekyarnO1CDFKF7NilFcsCu5iTFVbdHgcsCX1km5p39j3E85G2B6lptjNp HKqg== 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:sender:dkim-signature; bh=jsYTfAyddo367IDFzdQpxCbNtMumdTCO9J/dsgKO1IE=; b=f+6UNAvdFR9MqbE1y2p1aydpDD2lW7zOI+FwbrEMh1lpm0y2dTuHqceAULygx0uLD4 6/YnUrblrZLx0DNVP9HgHBLx8tSEhCzPgMCxELRUGzwpmyrOxA4ANUabzewlsZewHZPp JFxvBpiKfp3ugzvfrIv9K9BZHbgFrRzRimF6uH3fMu8wVhWwbuZKcCWZg4XEcau5ew7w WzqiTmIHC8Spd73NzPlg9ybGEmoxoH3Cnw53HzQGRPzp6Ic4liyE18rpPXmPNEpi6njK rSRT4KPlrC0z5MhsAyk2PfayRSt60cw4Uk7IQNBkJjywipkMaNPnNnfUPXh4tOgRpPMB iw9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=etfqZ32m; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si6527203edu.106.2021.02.05.20.04.02; Fri, 05 Feb 2021 20:04:25 -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=@gmail.com header.s=20161025 header.b=etfqZ32m; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231406AbhBFECe (ORCPT + 99 others); Fri, 5 Feb 2021 23:02:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43856 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232487AbhBFDBc (ORCPT ); Fri, 5 Feb 2021 22:01:32 -0500 Received: from mail-qv1-xf31.google.com (mail-qv1-xf31.google.com [IPv6:2607:f8b0:4864:20::f31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16479C06174A; Fri, 5 Feb 2021 19:00:52 -0800 (PST) Received: by mail-qv1-xf31.google.com with SMTP id l14so4491239qvp.2; Fri, 05 Feb 2021 19:00:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=jsYTfAyddo367IDFzdQpxCbNtMumdTCO9J/dsgKO1IE=; b=etfqZ32m21s7qD/Oo8PaMdd8ZJ/AMC7yYpO89fS0vn3zirJaF3BbEo+yKkwTUCjAQQ tGpXQnXizzt+65NyOovBqftshiZuHcEcbthq1v+JoPcZTMIGwQGtNe1uDUGmuAEM5jf8 C4YE4cE5euCOF6XFWa04yEOVtg+EczKUgf7atmpXKWgRvbYrJzdPnT98ZiCnschwlUJL UcbCNJvEmmjljr0zNUEv5xkD/0w4KeBUl7c5l3ddI/DSX/DY3lqXqCyS5vEvyI5oWAAi hex4hpU3tvTApMqrqON756efcFVTYjwONs6e6ljXlJoj1hWfxZ3E9YTiMkUygSeQ6+QF Hu9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=jsYTfAyddo367IDFzdQpxCbNtMumdTCO9J/dsgKO1IE=; b=MpDiFVk7FcDuIkMdrPUqcW/MRJFtYhEO49TGo+haPPGFjaXBj2+Hr/1mFcI2uTsMq3 maOb+RM4LwLQkBl4ZyqGCjPdENr6vbWoRsj8Hg1MCUFaGSNFr5lt3CEtjSQ+s1Kn6aUr rF4fJKuSPYwV3gPg04lpf0UcYjV+1NmwG17zE0aszwFI6e15tSsSIMt4MY3p8JWe9bhl xw8bQost1pQp//F7n5YZFgD2YPjopZdlkDEEliHniAhkIFyBrvdS3+ZyQip4Z/mdlQXu SiRZCIKqP/b9vSzJYMG8SLHWtYX4n84upYway9oMgV9yJIPWanDgNkNrhUrMI+WSWMgP HeMA== X-Gm-Message-State: AOAM530sB3ow0iV8wuX5jWa5qdaWUgYmebImOLM4J5Euya3+a+THwF/8 LrlEYxaEd54PxGE+Wm9NG4k= X-Received: by 2002:a05:6214:c65:: with SMTP id t5mr7337492qvj.19.1612580451166; Fri, 05 Feb 2021 19:00:51 -0800 (PST) Received: from localhost (dhcp-6c-ae-f6-dc-d8-61.cpe.echoes.net. [72.28.8.195]) by smtp.gmail.com with ESMTPSA id c17sm10964531qka.16.2021.02.05.19.00.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Feb 2021 19:00:50 -0800 (PST) Sender: Tejun Heo Date: Fri, 5 Feb 2021 22:00:00 -0500 From: Tejun Heo To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 4/8] cgroup: rstat: support cgroup1 Message-ID: References: <20210205182806.17220-1-hannes@cmpxchg.org> <20210205182806.17220-5-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210205182806.17220-5-hannes@cmpxchg.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 05, 2021 at 01:28:02PM -0500, 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 Acked-by: Tejun Heo Thanks. -- tejun