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 X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F4E1C433F5 for ; Fri, 10 Sep 2021 02:12:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 370BE61153 for ; Fri, 10 Sep 2021 02:12:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229730AbhIJCN4 (ORCPT ); Thu, 9 Sep 2021 22:13:56 -0400 Received: from out4436.biz.mail.alibaba.com ([47.88.44.36]:46026 "EHLO out4436.biz.mail.alibaba.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbhIJCNz (ORCPT ); Thu, 9 Sep 2021 22:13:55 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04400;MF=escape@linux.alibaba.com;NM=1;PH=DS;RN=11;SR=0;TI=SMTPD_---0Unqfudi_1631239952; Received: from B-W5MSML85-1937.local(mailfrom:escape@linux.alibaba.com fp:SMTPD_---0Unqfudi_1631239952) by smtp.aliyun-inc.com(127.0.0.1); Fri, 10 Sep 2021 10:12:33 +0800 From: "taoyi.ty" Subject: Re: [RFC PATCH 0/2] support cgroup pool in v1 To: Tejun Heo Cc: gregkh@linuxfoundation.org, lizefan.x@bytedance.com, hannes@cmpxchg.org, mcgrof@kernel.org, keescook@chromium.org, yzaikin@google.com, linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org, shanpeic@linux.alibaba.com References: Message-ID: <7b8d68c6-9a1c-dc19-e430-e044e4c4f210@linux.alibaba.com> Date: Fri, 10 Sep 2021 10:12:32 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org I am glad to receive your reply. cgroup pool is a relatively simple solution that I think can solve the problem. I have tried making locking more granular, but in the end found it too diffcult. cgroup_mutex protects almost all operation related to cgroup. If not use cgroup_mutex, I have no idea how to design lock mechanism to take both concurrent performance and existing interfaces into account. Do you have any good advice? thanks, Yi Tao On 2021/9/9 上午12:35, Tejun Heo wrote: > Hello, > > On Wed, Sep 08, 2021 at 08:15:11PM +0800, Yi Tao wrote: >> In order to solve this long-tail delay problem, we designed a cgroup >> pool. The cgroup pool will create a certain number of cgroups in advance. >> When a user creates a cgroup through the mkdir system call, a clean cgroup >> can be quickly obtained from the pool. Cgroup pool draws on the idea of >> cgroup rename. By creating pool and rename in advance, it reduces the >> critical area of cgroup creation, and uses a spinlock different from >> cgroup_mutex, which reduces scheduling overhead on the one hand, and eases >> competition with attaching processes on the other hand. > I'm not sure this is the right way to go about it. There are more > conventional ways to improve scalability - making locking more granular and > hunting down specific operations which take long time. I don't think cgroup > management operations need the level of scalability which requires front > caching. > > Thanks. >