linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Shakeel Butt <shakeelb@google.com>,
	NOMURA JUNICHI <junichi.nomura@nec.com>,
	Tejun Heo <tj@kernel.org>, Sasha Levin <sashal@kernel.org>,
	cgroups@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 08/18] cgroup: disable controllers at parse time
Date: Thu,  3 Jun 2021 13:10:19 -0400	[thread overview]
Message-ID: <20210603171029.3169669-8-sashal@kernel.org> (raw)
In-Reply-To: <20210603171029.3169669-1-sashal@kernel.org>

From: Shakeel Butt <shakeelb@google.com>

[ Upstream commit 45e1ba40837ac2f6f4d4716bddb8d44bd7e4a251 ]

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 memory
reclaim code.

[1] https://lore.kernel.org/linux-mm/921e53f3-4b13-aab8-4a9e-e83ff15371e4@nec.com

Signed-off-by: Shakeel Butt <shakeelb@google.com>
Reported-by: NOMURA JUNICHI(野村 淳一) <junichi.nomura@nec.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Tested-by: Jun'ichi Nomura <junichi.nomura@nec.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 ada060e628ce..99783685f3d9 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -5219,8 +5219,6 @@ int __init cgroup_init_early(void)
 	return 0;
 }
 
-static u16 cgroup_disable_mask __initdata;
-
 /**
  * cgroup_init - cgroup initialization
  *
@@ -5278,12 +5276,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 subsystem\n",
-			       ss->name);
+		if (!cgroup_ssid_enabled(ssid))
 			continue;
-		}
 
 		if (cgroup1_ssid_disabled(ssid))
 			printk(KERN_INFO "Disabling %s control group subsystem in v1 mounts\n",
@@ -5642,7 +5636,10 @@ static int __init cgroup_disable(char *str)
 			if (strcmp(token, ss->name) &&
 			    strcmp(token, ss->legacy_name))
 				continue;
-			cgroup_disable_mask |= 1 << i;
+
+			static_branch_disable(cgroup_subsys_enabled_key[i]);
+			pr_info("Disabling %s control group subsystem\n",
+				ss->name);
 		}
 	}
 	return 1;
-- 
2.30.2


  parent reply	other threads:[~2021-06-03 17:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-03 17:10 [PATCH AUTOSEL 4.14 01/18] spi: Fix spi device unregister flow Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 02/18] net/nfc/rawsock.c: fix a permission check bug Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 03/18] ASoC: sti-sas: add missing MODULE_DEVICE_TABLE Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 04/18] isdn: mISDN: netjet: Fix crash in nj_probe: Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 05/18] bonding: init notify_work earlier to avoid uninitialized use Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 06/18] netlink: disable IRQs for netlink_lock_table() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 07/18] net: mdiobus: get rid of a BUG_ON() Sasha Levin
2021-06-03 17:10 ` Sasha Levin [this message]
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 09/18] wq: handle VM suspension in stall detection Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 10/18] net/qla3xxx: fix schedule while atomic in ql_sem_spinlock Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 11/18] scsi: vmw_pvscsi: Set correct residual data length Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 12/18] scsi: target: qla2xxx: Wait for stop_phase1 at WWN removal Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 13/18] net: macb: ensure the device is available before accessing GEMGXL control registers Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 14/18] net: appletalk: cops: Fix data race in cops_probe1 Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 15/18] MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 16/18] bnx2x: Fix missing error code in bnx2x_iov_init_one() Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 17/18] powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P2041 i2c controllers Sasha Levin
2021-06-03 17:10 ` [PATCH AUTOSEL 4.14 18/18] powerpc/fsl: set fsl,i2c-erratum-a004447 flag for P1010 " Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210603171029.3169669-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cgroups@vger.kernel.org \
    --cc=junichi.nomura@nec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shakeelb@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).