Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4689656pxu; Tue, 13 Oct 2020 05:02:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxg2DydFiVLC0L6Ap9B7pcGtjSG+giqPZuJxLXMDQSj/evL7E4i6i+N+aXxo6XU4uazFURn X-Received: by 2002:aa7:c643:: with SMTP id z3mr17506154edr.104.1602590526727; Tue, 13 Oct 2020 05:02:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602590526; cv=none; d=google.com; s=arc-20160816; b=bzaBuIIj1HpDSQfH2ETZns7deIFeCl6E6Al2ulsnFH1Np+zq5lSGPekjY9vzyKrfd4 S0LQcTq0EnLgPOzrtWV6tvqnoem+vk/Q2vvMZI/f8ePbPryJ2LU3C6uNC6PGutJsdqo3 TDzz5pjl1lffXcG1AwgOAUzXk1FulE0U1tw1H+DDkeEQRd3Lf/joJjUpfTTT/c0UqUtC 0vpkNVHhRRRsqJg333YSccvbmxlWDNYQCfKiND/AH7ZNjRFlZg83AvAo2Wg5xaONNTHX JapuEVbyqqR+WmYA/NRDPNuKcwZCqYkNFARNkQIx86XJnYVs5LQkt48IGQXiSXoA85Qi PULQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:date:message-id:in-reply-to:subject :cc:to:from:user-agent:references; bh=kw2y1tn3qMQ3M1L5/KeGxNG3Ai4ey0qUVTHCYUpdUC0=; b=CqbxQ1UwTKcS7u20dGrNVlDyI8Vrzau9On7W/6z7Oi7vjJbIUQTBIWs8462py/To01 6BJSHqmQcVc0NbYA4xDwg4A+WcMzK+58U6lqs7naXjHuEjRUZZTbzgnrBvwnMkmrP7UD /LMeC5XT4YWikayUy0X+VuxqJNuwsYU7Ns80gPGvarwHrbQVveRx2G3cWAyZQEI3ZIDC ZO1YuSDc45UtiZkyYdKY/gkBcIiEdSJ1yoR5o4U/xYmZUC/gj55Ldp6nlFSycLtDR3Mb 9wij968bwqu+PnXlGZOruBo/08cMfWpaOed2VNPIwYftg/47iX2Nll9hsFNi6gSuVjBV W1CA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si14758833ejk.692.2020.10.13.05.01.43; Tue, 13 Oct 2020 05:02:06 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403863AbgJMI2P (ORCPT + 99 others); Tue, 13 Oct 2020 04:28:15 -0400 Received: from mail-ej1-f67.google.com ([209.85.218.67]:37181 "EHLO mail-ej1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390865AbgJMI2O (ORCPT ); Tue, 13 Oct 2020 04:28:14 -0400 Received: by mail-ej1-f67.google.com with SMTP id e22so27063322ejr.4 for ; Tue, 13 Oct 2020 01:28:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=kw2y1tn3qMQ3M1L5/KeGxNG3Ai4ey0qUVTHCYUpdUC0=; b=rHonCHq1TVe6BTihbB2RQ37HD7SamrJUtzwCvmXoukiNvoOu8/+9FbwhzZzBBNFo3M Z2xPxxOIQlg8trb0uTxgKBbjgygUzovvHW/kmWogeXfsM+fNR4ealHXBkAdNS61BLH3w oOUBmF0+D/rP5NeLoG6SP7cUXzi3xOYvZniBiFkV+tBVBN+v+/Tn3zW7nPS2Gcva/NeP YfLC71PbDGZLc0v2jVoot2wfp3pMavv5tOixBsh+mFFfSDm9R4CdKTBqBUr+uXNUi6s8 IXjvFmwC8/8S2Q6Glf/gaAXDgic92NgQ8HN5NjrPiSuVxi5G1SXWJj2p7lAfrxbj89mo r+HA== X-Gm-Message-State: AOAM533Dp4yiZwnxYfjB9wC9JfcLtzzDwiNU2GUSspSh9lDJEXIK7TPV vPf0ZNmgC/HMJd3Qu/1zJ7Y= X-Received: by 2002:a17:906:d8a3:: with SMTP id qc3mr32967568ejb.183.1602577692695; Tue, 13 Oct 2020 01:28:12 -0700 (PDT) Received: from darkstar ([2a04:ee41:4:5025:8295:1d2:ca0d:985e]) by smtp.gmail.com with ESMTPSA id l9sm6414695edn.75.2020.10.13.01.28.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Oct 2020 01:28:12 -0700 (PDT) References: <20201013053114.160628-1-juri.lelli@redhat.com> User-agent: mu4e 1.4.13; emacs 27.1 From: Patrick Bellasi To: Juri Lelli Cc: peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org, bristot@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, chris.redpath@arm.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, valentin.schneider@arm.com Subject: Re: [PATCH v2] sched/features: Fix !CONFIG_JUMP_LABEL case In-reply-to: <20201013053114.160628-1-juri.lelli@redhat.com> Message-ID: <878scail9o.derkling@matbug.net> Date: Tue, 13 Oct 2020 10:26:59 +0200 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 13, 2020 at 07:31:14 +0200, Juri Lelli wrote... > Commit 765cc3a4b224e ("sched/core: Optimize sched_feat() for > !CONFIG_SCHED_DEBUG builds") made sched features static for > !CONFIG_SCHED_DEBUG configurations, but overlooked the CONFIG_ > SCHED_DEBUG enabled and !CONFIG_JUMP_LABEL cases. For the latter echoing > changes to /sys/kernel/debug/sched_features has the nasty effect of > effectively changing what sched_features reports, but without actually > changing the scheduler behaviour (since different translation units get > different sysctl_sched_features). Hops, yes, I think I missed to properly check that config :/ Good spot! > Fix CONFIG_SCHED_DEBUG and !CONFIG_JUMP_LABEL configurations by properly > restructuring ifdefs. > > Fixes: 765cc3a4b224e ("sched/core: Optimize sched_feat() for !CONFIG_SCHED_DEBUG builds") > Co-developed-by: Daniel Bristot de Oliveira > Signed-off-by: Daniel Bristot de Oliveira > Signed-off-by: Juri Lelli (did you get some wrong formatting for the changelog above?) > --- > v1->v2 > - use CONFIG_JUMP_LABEL (and not the old HAVE_JUMP_LABEL) [Valentin] > --- > kernel/sched/core.c | 2 +- > kernel/sched/sched.h | 13 ++++++++++--- > 2 files changed, 11 insertions(+), 4 deletions(-) > > diff --git a/kernel/sched/core.c b/kernel/sched/core.c > index 3dc415f58bd7..a7949e3ed7e7 100644 > --- a/kernel/sched/core.c > +++ b/kernel/sched/core.c > @@ -44,7 +44,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(sched_update_nr_running_tp); > > DEFINE_PER_CPU_SHARED_ALIGNED(struct rq, runqueues); > > -#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) > +#ifdef CONFIG_SCHED_DEBUG > /* > * Debugging: various feature bits > * > diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h > index 28709f6b0975..8d1ca65db3b0 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -1629,7 +1629,7 @@ enum { > > #undef SCHED_FEAT > > -#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_JUMP_LABEL) > +#ifdef CONFIG_SCHED_DEBUG > > /* > * To support run-time toggling of sched features, all the translation units > @@ -1637,6 +1637,7 @@ enum { > */ > extern const_debug unsigned int sysctl_sched_features; > > +#ifdef CONFIG_JUMP_LABEL > #define SCHED_FEAT(name, enabled) \ > static __always_inline bool static_branch_##name(struct static_key *key) \ > { \ > @@ -1649,7 +1650,13 @@ static __always_inline bool static_branch_##name(struct static_key *key) \ > extern struct static_key sched_feat_keys[__SCHED_FEAT_NR]; > #define sched_feat(x) (static_branch_##x(&sched_feat_keys[__SCHED_FEAT_##x])) > > -#else /* !(SCHED_DEBUG && CONFIG_JUMP_LABEL) */ > +#else /* !CONFIG_JUMP_LABEL */ > + > +#define sched_feat(x) (sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) > + > +#endif /* CONFIG_JUMP_LABEL */ > + > +#else /* !SCHED_DEBUG */ > > /* > * Each translation unit has its own copy of sysctl_sched_features to allow > @@ -1665,7 +1672,7 @@ static const_debug __maybe_unused unsigned int sysctl_sched_features = > > #define sched_feat(x) !!(sysctl_sched_features & (1UL << __SCHED_FEAT_##x)) > > -#endif /* SCHED_DEBUG && CONFIG_JUMP_LABEL */ > +#endif /* SCHED_DEBUG */ > > extern struct static_key_false sched_numa_balancing; > extern struct static_key_false sched_schedstats;