Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp312613rwb; Tue, 13 Dec 2022 18:08:27 -0800 (PST) X-Google-Smtp-Source: AA0mqf6bKFS5rT8F5BxGMndIkD5Gp9VpBDtMZYzTWvLW4ztPlsDbQX3EW3qjNHZy5OwKkTl6CWrX X-Received: by 2002:a05:6402:3982:b0:461:9578:f904 with SMTP id fk2-20020a056402398200b004619578f904mr21012592edb.23.1670983707249; Tue, 13 Dec 2022 18:08:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670983707; cv=none; d=google.com; s=arc-20160816; b=cwL/EcD9ZgwxcpJUcTjA/BBIRLoNY/BTMIMQyZepUlhWSsVjGgf2jcnt9eghbaElWo gss9YzHvky675goDCFf3zjFA3COWS9AT7kIaO+WAV4gMW9fzPH6snyEIb20DO2IxWO7t WTU8kq010Uy+vdd+cj4KrIWkAm/GSfBJKBmrVtIEZy5RIfASH42rEa3fL51/TBtchOkL SNRmGvGvN0f52PVeWjn2tQEiGYaK9IljEcwkNQYF2xFa5Vc7cCDY4b3s2SrdOKIbtD4C 12DDARsgO2j7euXzVMbPeUXoNl4NVBnqjLTUZJAEwdzO39DRs9w9jL4FinN3ojOBOOWL nLSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=w8Ekv64Hnz3Pzaf7wbnhuAkFb+qhBlnUSB0ADt/wreE=; b=TPIxO4gfxe56eRs8bJG7boXeCoibDBK5HFqcC6pCuXqGFA+djIEsLN71xuWZoT1zID wVTF1PigCNe9fvdcu1SJrZ3daS/fBl3esCPE3J1V/jMBSWnPv7J+6QXwLnTw13pjvc/E Qgs3yvgI7F3dVQF06SZMzt1OBKlRFDXoEcrmiiUg3EUVjv7DV1+TnsB3CiItrXvDiLna Tl/AJj5LdnyYt+008gxwP2hCSfUESDP0Cqj/5YZqSyUOjc1I6tyb3al3oKKGQ8D4G1yF mAt1O4ODSWghHWbHX0WEvOozSx2H9WGr9OO3mOE5zzRS+tSv1hG2ey/SYdc2zhXMoZaI RjRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="bX5Ym2/M"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a05640227cf00b0046a279823d6si12668503ede.298.2022.12.13.18.07.37; Tue, 13 Dec 2022 18:08:27 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b="bX5Ym2/M"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236968AbiLNB7y (ORCPT + 72 others); Tue, 13 Dec 2022 20:59:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235762AbiLNB7v (ORCPT ); Tue, 13 Dec 2022 20:59:51 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 693E11276B for ; Tue, 13 Dec 2022 17:59:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1670983144; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=w8Ekv64Hnz3Pzaf7wbnhuAkFb+qhBlnUSB0ADt/wreE=; b=bX5Ym2/MjxRuFNdxYVxLFdn6jTmIqVfhbZ4qrmFTa8WhIb4BuQ1IUTNXR14CZXrk96Dw8R eDtrEw0nBRll/r7qm93JfwgtmGOvTiV+FHp9LCz/zoFs9IbH9zTqTjLoNHmHYmd8fDLqQu 7LeSDbwa4GBER76CWwEqAD0ViIapfNc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-251-ilEFFrkzO3qCiPUOWk815g-1; Tue, 13 Dec 2022 20:58:57 -0500 X-MC-Unique: ilEFFrkzO3qCiPUOWk815g-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2AF94185A78F; Wed, 14 Dec 2022 01:58:57 +0000 (UTC) Received: from [10.22.32.205] (unknown [10.22.32.205]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15AE02026D68; Wed, 14 Dec 2022 01:58:56 +0000 (UTC) Message-ID: <72fa1665-966a-76e6-be0c-e7fb288b1610@redhat.com> Date: Tue, 13 Dec 2022 20:58:53 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.0 Subject: Re: [PATCH-block v3 2/2] blk-cgroup: Flush stats at blkgs destruction path Content-Language: en-US To: Tejun Heo Cc: Jens Axboe , Josef Bacik , Zefan Li , Johannes Weiner , Andrew Morton , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, =?UTF-8?Q?Michal_Koutn=c3=bd?= , "Dennis Zhou (Facebook)" References: <20221213184446.50181-1-longman@redhat.com> <20221213184446.50181-3-longman@redhat.com> From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 12/13/22 14:30, Tejun Heo wrote: > On Tue, Dec 13, 2022 at 01:44:46PM -0500, Waiman Long wrote: >> + /* >> + * Flush all the non-empty percpu lockless lists so as to release >> + * the blkg references held by those lists which, in turn, may >> + * allow the blkgs to be freed and release their references to >> + * blkcg speeding up its freeing. >> + */ > Can you mention the possible deadlock explicitly? This sounds more like an > optimization. I am mostly thinking about the optimization aspect. Yes, deadlock in the sense that both blkgs and blkcg remained offline but not freed is possible because of the references hold in those lockless list. It is a problem if blkcg is the only controller in a cgroup. For cgroup that has both the blkcg and memory controllers, it shouldn't be a problem as the cgroup_rstat_flush() call in the release of memory cgroup will clear up blkcg too. Right, I will update the comment to mention that. Cheers, Longman