Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp874248pxf; Wed, 7 Apr 2021 13:52:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwIjfPzeeQiUPX/QNkx0F91FH8gpHQ3o8Um5JuK250NiiCStGc2lDQkLHxRVyFLEpL14bsi X-Received: by 2002:a17:906:8591:: with SMTP id v17mr6058739ejx.260.1617828753794; Wed, 07 Apr 2021 13:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617828753; cv=none; d=google.com; s=arc-20160816; b=AxQPe4VHtFLL7b9m+BEijTC63uCdGB43x1FpLf3g5Y2ZhQrPmFVNtDPM53NNYOwun1 hVSGo6s3yXnNZrIIYyvh7F80MMznufixMLB5yU+sgvCZRcHPomKLteacAQm7KAbaJlF/ TVsClSErP1cLCmyT9o8FrxxXKiHI1TukB1TSd7IVJV8omPNtLdRxKDktEUrTJ3aCnzzL i0HX8yk0QAjIhFYSWI3Vg+tNlKNEs3+rCGv60ddSIUxCZNg3M03ZzAxo1fQrKT91lxFh u6b9LMll2d9vV6+rnxe/YMl0DZ0I0xIa4EjfygRyw/2sK+/9bwa5kyXfSuHIo3Q8vp7e bd2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=RaNQhDEiJJpwtNequONLL/7uZWDuxijdSfinQFD0JOQ=; b=vV9ODki49qHRDFBOxowTtKO8JplrI/Ole5pUaZ2yV5qZl87aVP5mwbYoU+xm6sABWS /t15lKZfSiaEboM0TMfzWd4JV5L57CViqjPVWgF9M1SnczTmnxGSPVtuYbU7h0uQD77u 5KSJSnFFM7J42rj123jdW8XICmz7jUB0PisyJIIkIorRGse7cpQwK2Vy3CUoBZxvJmg9 VHdij7GwikmI0edAKx2YVqcNqgjROmEVE2iCrC2MNT36e/pFgenVMIsZxPDOr79lN1jW 1/Upl8eKo7DtRaINQCbdw9CxYgMyiyHbNWyEI+GWGfZQqfPz92cms64yl+7lblPhyPrJ o12g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c10si7139800ejb.312.2021.04.07.13.52.10; Wed, 07 Apr 2021 13:52:33 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351510AbhDGKr7 (ORCPT + 99 others); Wed, 7 Apr 2021 06:47:59 -0400 Received: from foss.arm.com ([217.140.110.172]:55210 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351480AbhDGKq6 (ORCPT ); Wed, 7 Apr 2021 06:46:58 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B18CF1FB; Wed, 7 Apr 2021 03:46:38 -0700 (PDT) Received: from e113632-lin (e113632-lin.cambridge.arm.com [10.1.194.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0AEEA3F694; Wed, 7 Apr 2021 03:46:36 -0700 (PDT) From: Valentin Schneider To: Peter Zijlstra , mingo@kernel.org, mgorman@suse.de, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, joshdon@google.com Cc: linux-kernel@vger.kernel.org, peterz@infradead.org, greg@kroah.com Subject: Re: [PATCH 7/9] sched,debug: Convert sysctl sched_domains to debugfs In-Reply-To: <20210326103935.264012208@infradead.org> References: <20210326103352.603456266@infradead.org> <20210326103935.264012208@infradead.org> Date: Wed, 07 Apr 2021 11:46:32 +0100 Message-ID: <87czv6nzhz.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 26/03/21 11:33, Peter Zijlstra wrote: > Stop polluting sysctl, move to debugfs for SCHED_DEBUG stuff. > > Signed-off-by: Peter Zijlstra (Intel) > --- > kernel/sched/debug.c | 255 ++++++++++-------------------------------------- > kernel/sched/sched.h | 2 > kernel/sched/topology.c | 1 > 3 files changed, 59 insertions(+), 199 deletions(-) > I do very much like to see a simple pair of seq_puts() replacing the mess I put in there! One comment below. > --- a/kernel/sched/debug.c > +++ b/kernel/sched/debug.c > +void register_sched_domain_sysctl(void) > +{ > + int cpu, i; > > if (!cpumask_available(sd_sysctl_cpus)) { > if (!alloc_cpumask_var(&sd_sysctl_cpus, GFP_KERNEL)) > return; > - } > - > - if (!init_done) { > - init_done = true; > - /* init to possible to not have holes in @cpu_entries */ > cpumask_copy(sd_sysctl_cpus, cpu_possible_mask); > } > > - for_each_cpu(i, sd_sysctl_cpus) { > - struct ctl_table *e = cpu_idx[i]; > + if (!sd_dentry) > + sd_dentry = debugfs_create_dir("domains", debugfs_sched); > > - if (e->child) > - sd_free_ctl_entry(&e->child); > + for_each_cpu(cpu, sd_sysctl_cpus) { > + struct sched_domain *sd; > + struct dentry *d_cpu; > + char buf[32]; > + > + snprintf(buf, sizeof(buf), "cpu%d", cpu); > + debugfs_remove(debugfs_lookup(buf, sd_dentry)); > + d_cpu = debugfs_create_dir(buf, sd_dentry); > + > + i = 0; > + for_each_domain(cpu, sd) { > + struct dentry *d_sd; > > - if (!e->procname) { > - snprintf(buf, 32, "cpu%d", i); > - e->procname = kstrdup(buf, GFP_KERNEL); > - } > - e->mode = 0555; > - e->child = sd_alloc_ctl_cpu_table(i); > + snprintf(buf, sizeof(buf), "domain%d", i); > + d_sd = debugfs_create_dir(buf, d_cpu); > > - __cpumask_clear_cpu(i, sd_sysctl_cpus); That seems to be the only place we cleared a CPU in that cpumask, and I don't see its replacement, which would go against: bbdacdfed2f5 ("sched/debug: Optimize sched_domain sysctl generation") With my very limited understanding of debugfs and sysctl, it seems that before we would have some stuff saved in sd_ctl_table and free/reinit just the bits we needed. With debugfs_remove(), I think we wipe everything clean, or did I read that wrong?