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 A692FC63797 for ; Fri, 13 Jan 2023 01:10:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231718AbjAMBKm (ORCPT ); Thu, 12 Jan 2023 20:10:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231896AbjAMBKi (ORCPT ); Thu, 12 Jan 2023 20:10:38 -0500 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4FFE626A; Thu, 12 Jan 2023 17:10:32 -0800 (PST) Received: from mail02.huawei.com (unknown [172.30.67.153]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4NtNdD73xbz4f3jLy; Fri, 13 Jan 2023 09:10:24 +0800 (CST) Received: from [10.174.176.73] (unknown [10.174.176.73]) by APP4 (Coremail) with SMTP id gCh0CgCX_7KBr8Bjs+d6Bg--.25500S3; Fri, 13 Jan 2023 09:10:27 +0800 (CST) Subject: Re: [PATCH v2 1/2] blk-iocost: add refcounting for iocg To: Tejun Heo , Yu Kuai Cc: hch@infradead.org, josef@toxicpanda.com, axboe@kernel.dk, cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, yi.zhang@huawei.com, "yukuai (C)" References: <7dcdaef3-65c1-8175-fea7-53076f39697f@huaweicloud.com> <875eb43e-202d-5b81-0bff-ef0434358d99@huaweicloud.com> <53b30ac8-d608-ba0b-8b1b-7fe5cfed6d61@huaweicloud.com> <4aeef320-c6c8-d9b4-8826-d58f00ea6264@huaweicloud.com> From: Yu Kuai Message-ID: Date: Fri, 13 Jan 2023 09:10:25 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgCX_7KBr8Bjs+d6Bg--.25500S3 X-Coremail-Antispam: 1UD129KBjvJXoW7Cr4kJryDWw4DZr18Gry3Arb_yoW8Jw1xpF WfW34ay3ykJrZ2v3ZFvw4rJr95tFy8AF4fKrZ8G3ya9w1Y9FySgF4SkFs2kF9xJFs3GF4Y vFWFgFn8Wa15AFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUU9Y14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvEwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2Y2ka 0xkIwI1lc7I2V7IY0VAS07AlzVAYIcxG8wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7x kEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E 67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCw CI42IY6xIIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rW3Jr0E 3s1lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVWUJVW8JbIYCT nIWIevJa73UjIFyTuYvjfUoOJ5UUUUU X-CM-SenderInfo: 51xn3trlr6x35dzhxuhorxvhhfrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, ÔÚ 2023/01/13 8:53, Tejun Heo дµÀ: > Hello, > > On Thu, Jan 12, 2023 at 02:18:15PM +0800, Yu Kuai wrote: >> remove the blkcg_deactivate_policy() from rq_qos_exit() from deleting >> the device, and delay the policy cleanup and free to blkg_destroy_all(). >> Then the policies(other than bfq) can only call pd_free_fn() from >> blkg_destroy(), and it's easy to guarantee the order. For bfq, it can >> stay the same since bfq has refcounting itself. >> >> Then for the problem that ioc can be freed in pd_free_fn(), we can fix >> it by freeing ioc in ioc_pd_free() for root blkg instead of >> rq_qos_exit(). >> >> What do you think? > > That would remove the ability to dynamically remove an rq_qos policy, right? > We don't currently do it but given that having an rq_qos registered comes > with perf overhead, it's something we might want to do in the future - e.g. Yes, that make sense, remove ioc and other policies dynamically. > only activate the policy when the controller is actually enabled. So, idk. > What's wrong with synchronizing the two removal paths? blkcg policies are > combinations of cgroups and block device configurations, so having exit > paths from both sides is kinda natural. I still can't figure out how to synchronizing them will a mutex. Maybe I'm being foolish... Thanks, Kuai