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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7189EC433FE for ; Mon, 10 Oct 2022 08:22:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbiJJIW5 (ORCPT ); Mon, 10 Oct 2022 04:22:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230082AbiJJIWi (ORCPT ); Mon, 10 Oct 2022 04:22:38 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8474D5A81F; Mon, 10 Oct 2022 01:22:37 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 293E721901; Mon, 10 Oct 2022 08:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1665390156; 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=HJPGZK8y3k1EdlBwZWhtE19zM4qXrS86KACobAplA5c=; b=j0gqi2tCSAYg+2GXk/+EeCES7X6tg7S5oB0vr83zi2nQduiHZw+W2Hu5aF1zlINr5XVka4 pbLxvD7u3GAstRFlR5w2//DEvpjXzNRxEPes7o0VwDIoyv9Why785oh7sj7wVrfeO43mtL 315BMCvGL8cnHWCnlROYGj6JZaJcGow= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F2C0413ACA; Mon, 10 Oct 2022 08:22:35 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id l2DkOEvWQ2NkbAAAMHmgww (envelope-from ); Mon, 10 Oct 2022 08:22:35 +0000 Date: Mon, 10 Oct 2022 10:22:34 +0200 From: Michal =?iso-8859-1?Q?Koutn=FD?= To: Tejun Heo Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Zefan Li , Johannes Weiner , Dan Carpenter Subject: Re: [PATCH v2] cgroup: Reorganize css_set_lock and kernfs path processing Message-ID: References: <20220905170944.23071-1-mkoutny@suse.com> 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 Wed, Oct 05, 2022 at 06:47:31AM -1000, Tejun Heo wrote: > Hmm... isn't current's root cgrp guaranteed to be alive? True on the default hierarchy. v1 hierarchies (singular ones with root cgroup only) can be unmounted. > How would cgroup_get_live() fail? kill_sb is not synchronized via css_set_lock. > Also, shouldn't cgroup_get() enough for path walking? If ref count dropped to zero, release callback (css_release_work_fn) would be queued, cgroup_get would increase the refcount but it won't cancel this. Note these were concerns with the first version of the patch that also touched cgroup_show_path() (that processes v1 hierarchies too). With the reduction I avoided this. Strictly speaking, even css_set_lock is unnecessary around current_cgns_cgroup_from_root() when called with cgrp_dfl_root as the cset->cgrp_links is not traversed at all. > If you really wanna do it this way, can you please add a detailed comment > here why this is safe? But I'd prefer just doing a strightforward ref > inc/dec around it. I see the the extraction under css_set_lock without inc/dec turns out confusing. Let me expand the idea above and avoid css_set_lock completely (another message). Michal