Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp389748rwi; Mon, 10 Oct 2022 01:42:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM479QCtV7hyu4fE51EEnfilrPcr4nBnznSWdxWQJ9F0JPmXoBIgZ3DwvuAjK1u7VBpTEldv X-Received: by 2002:a17:903:240b:b0:178:a475:6644 with SMTP id e11-20020a170903240b00b00178a4756644mr18238483plo.96.1665391353837; Mon, 10 Oct 2022 01:42:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665391353; cv=none; d=google.com; s=arc-20160816; b=o7rKW3UXxS6H2G9XSGO4HDLlweKsmy85yZm0InCLyZYQIeDTWDAPSAEYabhihG3IyI B44YLJTvVtihczsTk7ZivV7/UlNcA7AD7+h5tOPvz7YLOzV8CZvS5cDInjStPvRp3sQD JX9hQJp68rP1MQwuD8hiT55JfkP8Eirib9CSCvDl+jIAY6B5cYTHI/ebIQiMrI1GCYo+ 5hB1zgXinBCocZHPDcGTOBwXKn8X5cWMlAUM05eryDF9+FU63gcaOkJmU+O2CPAbtHfk GbxJUx0TWRZudz8ZQzNvzUbSzm3SVEy716HADvs+V1z5iqf/MWUrVAyzf+4NUZfX+t9b dWWQ== 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=HJPGZK8y3k1EdlBwZWhtE19zM4qXrS86KACobAplA5c=; b=ckA5+/ptZ+piTXlIFY6j+Kk9KqvAymkCaZSBgKAZTlOprhwECsPcIK3/D0gMpixS9V zxSM6a5til2jnI4jVnQBMKi/lw4THA90yqvvFP8MH8xKHDDk0IiJVq7cmYVumhc5NWSt +a1CIf70LSGP1aYIzRx1lMQ0lumKKBnZZK4/UQAFD9E6O3lrH/nlCc0MuRjQUBbUfo4/ QE3L/2M1RLoKoAhmVtdI5aCcjkt+JJEr6AX/vUYjL3A3n+BDQ214iLw1usVsEHHv7iMs j062eJ+vsUQFFYRmIDpYRllOpY7Ay94FpJv8z4eaM8atGkB1zrFPNl+1iI67RMyLQaFc q8Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=j0gqi2tC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e17-20020a170903241100b0017cb3aec328si9433860plo.279.2022.10.10.01.42.19; Mon, 10 Oct 2022 01:42:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=j0gqi2tC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbiJJIW5 (ORCPT + 99 others); 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: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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