Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4836050imu; Tue, 29 Jan 2019 08:17:36 -0800 (PST) X-Google-Smtp-Source: ALg8bN4J52wIfwGqaFJbRbCu6r8zUperkL8UmdZNrfIv76iNGgDQgYAHqBFPgw6KGvqGx2uL9Cbv X-Received: by 2002:a63:134f:: with SMTP id 15mr24024759pgt.19.1548778656006; Tue, 29 Jan 2019 08:17:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548778655; cv=none; d=google.com; s=arc-20160816; b=TQ7rw2AGTl8fFCjQnHtuK2uLxor8aAXqjfWql4V+fM2vxbYe++1s/MSJ1FfdmE7Y02 geJ+4PGs8K2kaZbPFB8adO56VhgMAcqzoz1G9BjQgI54avbzYzQQMl+IWbUisNHslGaj ncwckMBPBKjZa1lN7R1eID3ygpDszEI4X5b9XJ3UFBgDciFwdZurPmf3ffUODExb7mE4 dXUKFKAzyBsm52r17EcMfcrdMjpDQ2IPluTT7mcibYGORwgFCIyrbAnNMq+Aq9owAzQd R+PebXvFO11SwdIKUjRcRDJNKETat7Q4qw5VYkkvM+a1pa3LZna3uA8d+BFiIkuCn/0U qwug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=9DgJodNo9K2Y1jZ0uKBeIfDhjVu1GoYAkBgceYrhAzs=; b=cPcs6zB9yHaJechNpmP++vS0MN9sYvgtbHpwl83SH9npfeS/12IOh/4/IZIhKqgyrq ufM13/hAPR09Sjpr9Aj3T5v0tXRwF4BS33VjyRYD/scI3vXEt2LaC21B/dzYHbtkpxO0 4KC/xjHDa68D95Dn8ofp/ii0L63ZUU2F2wwmWtY8EPuW/irEfmDEUQ73Dg+Db8KTP4kM MSIFmP7ZbomX+9m4Y2WbJUAK+JeCF+SjesDa5URHnB9cqJNXhZWAc12qgJjTi+D5pgIp QbeP0dkgqf74UdvIANCws0b/H3GoqUCktBA8SINKZjaxkCiOLM+karR1eYimFZ2W4n7B ABzA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a19si9482714pgj.429.2019.01.29.08.17.20; Tue, 29 Jan 2019 08:17:35 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727246AbfA2QQv (ORCPT + 99 others); Tue, 29 Jan 2019 11:16:51 -0500 Received: from mx1.redhat.com ([209.132.183.28]:50728 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725828AbfA2QQv (ORCPT ); Tue, 29 Jan 2019 11:16:51 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B7346806B6; Tue, 29 Jan 2019 16:16:50 +0000 (UTC) Received: from localhost.localdomain (ovpn-121-54.rdu2.redhat.com [10.10.121.54]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB59D5D97E; Tue, 29 Jan 2019 16:16:49 +0000 (UTC) Subject: Re: [PATCH] sched/debug: initialize sd_sysctl_cpus if !CONFIG_CPUMASK_OFFSTACK To: Masayoshi Mizuma , Ingo Molnar , Peter Zijlstra , linux-kernel@vger.kernel.org Cc: Hidetoshi Seto References: <20190129151245.5073-1-msys.mizuma@gmail.com> From: Joe Lawrence Organization: Red Hat Message-ID: Date: Tue, 29 Jan 2019 11:16:44 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20190129151245.5073-1-msys.mizuma@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 29 Jan 2019 16:16:50 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/29/2019 10:12 AM, Masayoshi Mizuma wrote: > 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 nit: s/allocataion/allocation (perhaps maintainer can fixup?) > 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) { > Thanks for posting ... looks good on aarch64 where the issue mentioned in the commit message was reported. Acked-by: Joe Lawrence -- Joe