Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1691575pxj; Wed, 19 May 2021 11:34:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl0T9CXG5xRULPGl+NMWrpjG2u/VC+Lkj2naHrQrqey7THJKG8JunLzhJod2DZ3quGPrA9 X-Received: by 2002:a17:906:1c04:: with SMTP id k4mr485331ejg.197.1621449266973; Wed, 19 May 2021 11:34:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621449266; cv=none; d=google.com; s=arc-20160816; b=InLhjMzcVAEsPEHjTAaBYUfOJ/VOfdfwk/9sS1yDO3X+ZSze0Y7ciUORmnGjOJDora zOh7RToLj75SE7XvKqSiCb3Try7nCZ3wOpinZv+3GPr/S2dGzsfDJkre6XIRYDf/qbWV xwm8u9BSpiCO1PY3tiBmaSw/jNAugx1b1jxz2QePZ9qia3hshef38BRxRWXI9KiJyjmy khYBApSq7ZTl68HDM8kpoi8GV14NqC/QiXgyz/B/uxTgv1RU4HLunpvg3AqF9gRhtAOO dTdLWEeMjTJlTbsLP8BYg43ZlJqLRcoqZuF9C1I6W1mTyhyqKe9mD/0l3Wn+ynL/7FYy Yspw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=NIbWp7tup4eVOlx3Pu4l4njVP4uN2qbWLCiCWarrYCE=; b=V0Xt4/rgXIR4VENK3pJlRz4Bue118rwxyHCq0W8ft0jkEmxuQzEQAlqD+5VMwX0JoD TDhFFgpyCrlxLukAFOV/+LwHEWr0KWZrlf2Wi43YU+RpZl0N39lZaeav54m+/afzI9Sr ZS/tELnXF8YJcB7pT/TCSDQi2aIonJZJTbyJHzqKEj/BvfDk7LKOVO8ZVoaW9chnsKq9 uoeW0d2cGGfqwlXheXYTjmZZ8D//zC58qD7K+97DNczlmCDa5lxz52qeRWL9cURwRTnl /2JQH3kdCoH3VjoUcpwZZ0tYGovCkiSSgtdOHbGaSMyJh/p7H+ki5uYcrakkDlN2SStt UHnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HNSW85ax; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si305723ejd.259.2021.05.19.11.34.02; Wed, 19 May 2021 11:34:26 -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=@gmail.com header.s=20161025 header.b=HNSW85ax; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351980AbhERTzl (ORCPT + 99 others); Tue, 18 May 2021 15:55:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351976AbhERTzk (ORCPT ); Tue, 18 May 2021 15:55:40 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 079B5C061573; Tue, 18 May 2021 12:54:22 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id l1so16460447ejb.6; Tue, 18 May 2021 12:54:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NIbWp7tup4eVOlx3Pu4l4njVP4uN2qbWLCiCWarrYCE=; b=HNSW85axgCU+zrmo9twXR0r0XwE9BPovx+g1TTiC4PJGaOmGv73DrM2Ldht2i7h1up HLuPg+LbH89LIVsSLGrVrVJSJTN5tws64xNj3s25GyRupAAGwWocdYv5/lx38Lq/2DVx wi9TuSa+kGG4bUVbxkJcGvc1BnnYLthm2t5Lhg+PqOIKdITFj6UvvIcOf8RPLEr3TgVb qx+jTnNmXrnO9QSIdZfLSOd9tApK+NCvSTK+fGl0XY7y23mggWyuWJx3NvERPvLVn9pt NBjj4fo+DupkQy/1AvuuX/n/F9t7BpMG/yxtN9NJWrK6lU0w4cWVQGOhEeQyzowQgZpb PRgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=NIbWp7tup4eVOlx3Pu4l4njVP4uN2qbWLCiCWarrYCE=; b=c6oF7cKs89a4M6tSx9dsGZU08Pg1ZHhPs8o28L/6naU/7WbjSueAbX3+KJ21Rot8pU uHs7u6U0xNdN8SV6oyP2ryctDPo2xtWk+9RhscV3ksJgP79pdmuQR1t8spR4ycBF9wPE RFX1JUNYCLnVT7bppls6UHPImeEAOF/1aPFo1QNpKQeP0O1+b2g5/PUxc6bY/0KLWiOd GX4OcSnmsU8cZL2jlddK8fZQI6/E9FGQX4bOfGY6kKKcUOnv6bhCY4EW/UuKZ1onG5ZJ 1tRVr1j8Yey0Pph/+uQCP6vgbF0eycFCmB6s/RgboaBjVlesqZxpxBx1JXeYc7g2zLW3 UvTA== X-Gm-Message-State: AOAM533sB2OjAH8usp+LWihXQ6YbBuwxF5XkfckTMqVkkI3YKOOiU/4X UzlrCM9tpFrwgsMCN40KzmDVDcKVc53saoXJfhZuJ3OKNx8= X-Received: by 2002:a17:906:b7d6:: with SMTP id fy22mr7551361ejb.383.1621367660756; Tue, 18 May 2021 12:54:20 -0700 (PDT) MIME-Version: 1.0 References: <20210512201946.2949351-1-shakeelb@google.com> In-Reply-To: From: Yang Shi Date: Tue, 18 May 2021 12:54:09 -0700 Message-ID: Subject: Re: [PATCH] cgroup: disable controllers at parse time To: Shakeel Butt Cc: Tejun Heo , Zefan Li , Johannes Weiner , =?UTF-8?B?Tk9NVVJBIEpVTklDSEko6YeO5p2RIOa3s+S4gCk=?= , Andrew Morton , Cgroups , Linux MM , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 18, 2021 at 11:13 AM Shakeel Butt wrote: > > On Wed, May 12, 2021 at 1:19 PM Shakeel Butt wrote: > > > > This patch effectively reverts the commit a3e72739b7a7 ("cgroup: fix > > too early usage of static_branch_disable()"). The commit 6041186a3258 > > ("init: initialize jump labels before command line option parsing") has > > moved the jump_label_init() before parse_args() which has made the > > commit a3e72739b7a7 unnecessary. On the other hand there are > > consequences of disabling the controllers later as there are subsystems > > doing the controller checks for different decisions. One such incident > > is reported [1] regarding the memory controller and its impact on memor= y > > reclaim code. > > > > [1] https://lore.kernel.org/linux-mm/921e53f3-4b13-aab8-4a9e-e83ff15371= e4@nec.com > > > > Signed-off-by: Shakeel Butt > > Reported-by: NOMURA JUNICHI(=E9=87=8E=E6=9D=91=E3=80=80=E6=B7=B3=E4=B8= =80) > > Nomura, I think you have already tested this patch, so, can you please > add your tested-by tag? > > Tejun, any comments or concerns? > > Yang, do you think we should add Fixes tag to make sure this patch > lands in 5.13 where your shrinker patches landed? Yes, I think we should, please do that. > > > --- > > kernel/cgroup/cgroup.c | 13 +++++-------- > > 1 file changed, 5 insertions(+), 8 deletions(-) > > > > diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c > > index e049edd66776..e7a9a2998245 100644 > > --- a/kernel/cgroup/cgroup.c > > +++ b/kernel/cgroup/cgroup.c > > @@ -5634,8 +5634,6 @@ int __init cgroup_init_early(void) > > return 0; > > } > > > > -static u16 cgroup_disable_mask __initdata; > > - > > /** > > * cgroup_init - cgroup initialization > > * > > @@ -5694,12 +5692,8 @@ int __init cgroup_init(void) > > * disabled flag and cftype registration needs kmalloc, > > * both of which aren't available during early_init. > > */ > > - if (cgroup_disable_mask & (1 << ssid)) { > > - static_branch_disable(cgroup_subsys_enabled_key= [ssid]); > > - printk(KERN_INFO "Disabling %s control group su= bsystem\n", > > - ss->name); > > + if (!cgroup_ssid_enabled(ssid)) > > continue; > > - } > > > > if (cgroup1_ssid_disabled(ssid)) > > printk(KERN_INFO "Disabling %s control group su= bsystem in v1 mounts\n", > > @@ -6214,7 +6208,10 @@ static int __init cgroup_disable(char *str) > > if (strcmp(token, ss->name) && > > strcmp(token, ss->legacy_name)) > > continue; > > - cgroup_disable_mask |=3D 1 << i; > > + > > + static_branch_disable(cgroup_subsys_enabled_key= [i]); > > + pr_info("Disabling %s control group subsystem\n= ", > > + ss->name); > > } > > } > > return 1; > > -- > > 2.31.1.607.g51e8a6a459-goog > >