Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4769525imu; Tue, 29 Jan 2019 07:14:27 -0800 (PST) X-Google-Smtp-Source: ALg8bN7HOWOQ/y342hAudQWQEbCErqEtzXG0x39AdDlkoZElGFq1zcn34mtRyQNBBrEumCFrtQBP X-Received: by 2002:a17:902:3064:: with SMTP id u91mr25937720plb.325.1548774867030; Tue, 29 Jan 2019 07:14:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548774866; cv=none; d=google.com; s=arc-20160816; b=ucbgCobqQDjJN/JFeM4QhOMUxyR1GQTdjw/IDGtCWeuxhnocjQ1Dhfc9iewj1cgypO mUZI3lY8V6kPlHCABqqw3Dv7LRUpD0S9sFpzL/JBdSRnpT1BlC0eZuHIwy5wtkr1Tfpt qca0dneUyCKqzurR9u3haz53LBUx06HF6bWHrimGcqtcCJtyqMQc5fQjn8qucLecfgNm 4K0/g7FzYc8qGAdRqpo41Z64cGbxp/J6AbuYWHnyqjWdVe7ZPoE+elgpTEtqx7FLjtwR IU7o4wtSIorec8iOjDgVuC2YFyar5PHbo+PxvcFamuUW/e9w5+FNFk9BSFnTLDk2SuUx 4Kjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=TWtLBy/hb49JcJ7axTK/C1lManiIeaMQK/o8nwSDRAs=; b=Y+45dgUtg8uLssE4XKEHGK2AKGdqMhgVcjkK+BtMqCjtZ8BHwCanYuqIL4ix7X3IEY PfC51DwXg6GMzSLQ98JkDJ5dMDY502iKTDnZ1s/urQ/WHWbfO7lHRdT9rHs40Sy0QaPo atx/TgDYMAwIslyMbH8GU5nHN4LkM+vEkDQ3cjs0TalIJ22SCZ8FAXgqPUlEEfxLmZu7 tsOLvaatKK79fwaslu+4bVphwi+JeXfx0bRsOUPWk8LgurrEmOsGKu4HaE0zGM3kumj+ 1isGjfpDaEMxuWykD+o6jWNZdtQrR0gf628hLuVXIV0aopkLlUOrs4k9TSzRC2K2yIvL ADog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fEOZ3jUe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 24si30942957pgm.167.2019.01.29.07.14.11; Tue, 29 Jan 2019 07:14:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fEOZ3jUe; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728448AbfA2PNb (ORCPT + 99 others); Tue, 29 Jan 2019 10:13:31 -0500 Received: from mail-qt1-f196.google.com ([209.85.160.196]:37305 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726417AbfA2PNb (ORCPT ); Tue, 29 Jan 2019 10:13:31 -0500 Received: by mail-qt1-f196.google.com with SMTP id t33so22556309qtt.4 for ; Tue, 29 Jan 2019 07:13:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=TWtLBy/hb49JcJ7axTK/C1lManiIeaMQK/o8nwSDRAs=; b=fEOZ3jUeEIRaFK/06K3OVaHiTRZcnGsCAj/ZwQuPPWBoTdn1Y00FIZe/np/l/WwGmo Vwc1nNWrox+UZ7GjmGNBnTD7u06Q1vQURwryF7f++TemNnveTwjrQ6LRqsORayH9EOQE 7ubFeCwkrHEJPjNvSWrzs8tr823pW4GYpUwA/hbcZV8ygjPwfDmfC8Wznxyq1kyWm9bV b900LOUCs5g31GyUDNUwVFdeUEcq0l5RemiwSH4FNoysCpxn8f5Z9/exYgCHZxHlKNyd hjOpJ0a9uGSSL3Q4o8wmaRmVgYlfUHvz6wNkfrQGDEBaSbJmFY60gt0EI27I7g+moqsk 57Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=TWtLBy/hb49JcJ7axTK/C1lManiIeaMQK/o8nwSDRAs=; b=QHvsZnhrhWOacFQqdFxOMVXe94W8gnjdCivQtYOVMKxjDDeYgOllv1ZvDZl9CbTEPR oezxpib6O7mGClz3gQf/nGJfNJEmowqO9aEjxOIIZvjEKRwhc4JwsWv3cJuvQQFLl/QP 2OCJXqf02OjeyD6cTiThGxNhEJJa7pyQjt7YGi5v+zVGyG43OYD8cjikUraJUsWX+f5z FqIGDWV+HUFDj6lxpJrtpB6EtgsHxTUE6eTi+5129/h21H6Y++A2cZo1bgunsygDxrB7 TDU74z7EAMjxQn+BYHSGbGf6PBh8ZbVwJD1kZhwlNhT0bSxuqTclCVOBByPIe/Irk+Yi VhDQ== X-Gm-Message-State: AJcUukdh6iZ3BE+64jsLfWi7CwjWv7v0Lh3/9Ddi9k2Mr9mKLoCnOf0I 4BEKikISJNgniFsycxAIMQ== X-Received: by 2002:ac8:2614:: with SMTP id u20mr26434728qtu.28.1548774810130; Tue, 29 Jan 2019 07:13:30 -0800 (PST) Received: from gabell.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id t123sm66387806qkc.6.2019.01.29.07.13.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 29 Jan 2019 07:13:29 -0800 (PST) From: Masayoshi Mizuma To: Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Cc: Masayoshi Mizuma , Hidetoshi Seto , Joe Lawrence Subject: [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK Date: Tue, 29 Jan 2019 10:12:45 -0500 Message-Id: <20190129151245.5073-1-msys.mizuma@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hidetoshi Seto register_sched_domain_sysctl() copies the cpu_possible_mask into sd_sysctl_cpus, but only if sd_sysctl_cpus hasn't already been allocated (ie, CONFIG_CPUMASK_OFFSTACK is set). However, when CONFIG_CPUMASK_OFFSTACK is not set, sd_sysctl_cpus is left uninitialized (all zeroes) and the kernel may fail to initialize sched_domain sysctl entries for all possible cpus. This is visible to the user if the kernel is booted with maxcpus=n, or if ACPI tables have been modified to leave cpus offline, and then checking for missing /proc/sys/kernel/sched_domain/cpu* entries. Fix this by separating the allocataion and initialization, and adding a flag to initialize the possible cpu entries while system booting only. Signed-off-by: Hidetoshi Seto Reviewed-by: Masayoshi Mizuma Tested-by: Syuuichirou Ishii Tested-by: Tarumizu, Kohei --- kernel/sched/debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c index de3de997e245..9c6637f3e21d 100644 --- a/kernel/sched/debug.c +++ b/kernel/sched/debug.c @@ -310,6 +310,7 @@ static struct ctl_table *sd_alloc_ctl_cpu_table(int cpu) static cpumask_var_t sd_sysctl_cpus; static struct ctl_table_header *sd_sysctl_header; +static int register_sched_domain_sysctl_on_boot = 1; void register_sched_domain_sysctl(void) { @@ -344,9 +345,12 @@ void register_sched_domain_sysctl(void) if (!cpumask_available(sd_sysctl_cpus)) { if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL)) return; + } + if (register_sched_domain_sysctl_on_boot) { /* init to possible to not have holes in @cpu_entries */ cpumask_copy(sd_sysctl_cpus, cpu_possible_mask); + register_sched_domain_sysctl_on_boot = 0; } for_each_cpu(i, sd_sysctl_cpus) { -- 2.20.1