Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp526435pxb; Wed, 8 Sep 2021 06:40:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7eZJEwWhoFbx1HnBFlDv/omGw9lrmqOuHWZG4Qw3OaPuDdBgKiADFYnZeDgBbNtVeuzZv X-Received: by 2002:a6b:7b4b:: with SMTP id m11mr3348728iop.165.1631108443876; Wed, 08 Sep 2021 06:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631108443; cv=none; d=google.com; s=arc-20160816; b=r7yZFbeaJkzcNMGXE7H594nU0Y/1G709Ctw8UjVWtxeZbYj3H4OFGzbr8P+889rIzG d9uw30IQIj8ROua74IJH2lIuHKScr1byXxch4BiK/4qCcSfFC+4PCoNUvK45y4vH1P41 wiwgydqSSL2jpdd/4U1Q+vcyjH9LH0Xje5pcuFRIPnW1yHDoi96+g1slVK5KyZUjve3/ 1mxwi5Gpa5mKuG/xZYyf2364c2fadeH/MB57Bxk15RMmIAeRwdk3YnHyhTSVDi/Gg+Bx KKhxy1dcKcU3CZBZDkvMnbfkvhfivPbSBWyR1RhvNnY2ZIf6JcBrAslWB3BdehTVxOxi b3yQ== 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=X73BDdp9ncPDAV4Kwfj9tSh+EicB8v93R3uG+3IpguA=; b=nNwXdMcqfOYELOuEL8icCM01rNVeBJUezAm4OSsFoNKyZvn+CDvtupeFn3Elm8kjua 6psVoBJSVT3jTJ9BhllWWkazPrZdOZhXs0uKqgtK3K+rH3sKHlfHm69uOsHOwGgCYEJm bZJs6tynhtgv14+Hi92gcNr9QvytTFkGzaxu9EAeW19S2kNhvVEZp9vGe39RUHBQA+lo 9FszDj5n+s7UJNqcOlOhL6DKQtvz64nSbtieuhBY4TH/AiZLHpVGmooWgLyi/fiG/CCp yX809uHw1UascWmRBIqL7Bays484wpbyJ2V1+zqTOSBea+lZYwHx1K+j2kFY4/gSNHa9 gGJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xpJKSosN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t42si2350014jal.13.2021.09.08.06.40.31; Wed, 08 Sep 2021 06:40:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xpJKSosN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351626AbhIHMhH (ORCPT + 99 others); Wed, 8 Sep 2021 08:37:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:35098 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241128AbhIHMhG (ORCPT ); Wed, 8 Sep 2021 08:37:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 76C216069E; Wed, 8 Sep 2021 12:35:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631104558; bh=IeEnqVOQ4/mgD07WFn13/gOR/som678mwOUAhNFnUrw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=xpJKSosNTteuQ/VVdeadIgG4tjl+qcTdHD4iyKneWU+L1j4w3oaSUDd1o2Fz98GB3 PPw9uyyWv5GZp0vWFP1YTYyVNxjQrYEkgJhV5dlCubxCpwKnA/9fujGQ57M0kZgV4o STO7zQXsQfWUcgLRELcTHek7B+140EXCnajiPEMM= Date: Wed, 8 Sep 2021 14:35:56 +0200 From: Greg KH To: Yi Tao Cc: tj@kernel.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 Subject: Re: [RFC PATCH 2/2] support cgroup pool in v1 Message-ID: References: <03e2b37678c9b2aef4f5dee303b3fb87a565d56b.1631102579.git.escape@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <03e2b37678c9b2aef4f5dee303b3fb87a565d56b.1631102579.git.escape@linux.alibaba.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 08, 2021 at 08:15:13PM +0800, Yi Tao wrote: > Add pool_size interface and delay_time interface. When the user writes > pool_size, a cgroup pool will be created, and then when the user needs > to create a cgroup, it will take the fast path protected by spinlock to > obtain it from the resource pool. Performance is improved by the > following aspects: > 1.reduce the critical area for creating cgroups > 2.reduce the scheduling time of sleep > 3.avoid competition with other cgroup behaviors which protected > by cgroup_mutex > > The essence of obtaining resources from the pool is kernfs rename. With > the help of the previous pinned kernfs node function, when the pool is > enabled, these cgroups will be in the pinned state, and the protection > of the kernfs data structure will be protected by the specified > spinlock, thus getting rid of the cgroup_mutex and kernfs_rwsem. > > In order to avoid random operations by users, the kernfs nodes of the > cgroups in the pool will be placed under a hidden kernfs tree, and users > can not directly touch them. When a user creates a cgroup, it will take > the fast path, select a node from the hidden tree, and move it to the > correct position. > > As users continue to obtain resources from the pool, the number of > cgroups in the pool will gradually decrease. When the number is less > than a certain value, it will be supplemented. In order to avoid > competition with the currently created cgroup, you can delay this by > setting delay_time process > > Suggested-by: Shanpei Chen > Signed-off-by: Yi Tao > --- > include/linux/cgroup-defs.h | 16 +++++ > include/linux/cgroup.h | 2 + > kernel/cgroup/cgroup-v1.c | 139 ++++++++++++++++++++++++++++++++++++++++++++ I thought cgroup v1 was "obsolete" and not getting new features added to it. What is wrong with just using cgroups 2 instead if you have a problem with the v1 interface? thanks, greg k-h