[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200619174510.GB576888@hirez.programming.kicks-ass.net>
Date: Fri, 19 Jun 2020 19:45:10 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Qais Yousef <qais.yousef@....com>
Cc: Ingo Molnar <mingo@...hat.com>, Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>, Mel Gorman <mgorman@...e.de>,
Patrick Bellasi <patrick.bellasi@...bug.net>,
Chris Redpath <chrid.redpath@....com>,
Lukasz Luba <lukasz.luba@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] sched/uclamp: Protect uclamp fast path code with
static key
On Thu, Jun 18, 2020 at 08:55:25PM +0100, Qais Yousef wrote:
> +/*
> + * This static key is used to reduce the uclamp overhead in the fast path. It
> + * only disables the call to uclamp_rq_{inc, dec}() in enqueue/dequeue_task().
> + *
> + * This allows users to continue to enable uclamp in their kernel config with
> + * minimum uclamp overhead in the fast path.
> + *
> + * As soon as userspace modifies any of the uclamp knobs, the static key is
> + * disabled, since we have an actual users that make use of uclamp
> + * functionality.
> + *
> + * The knobs that would disable this static key are:
> + *
> + * * A task modifying its uclamp value with sched_setattr().
> + * * An admin modifying the sysctl_sched_uclamp_{min, max} via procfs.
> + * * An admin modifying the cgroup cpu.uclamp.{min, max}
> + */
> +DEFINE_STATIC_KEY_TRUE(sched_uclamp_unused);
Maybe call the thing: 'sched_uclamp_users', instead?
> + if (static_branch_unlikely(&sched_uclamp_unused))
> + static_branch_disable(&sched_uclamp_unused);
> + if (static_branch_unlikely(&sched_uclamp_unused))
> + static_branch_disable(&sched_uclamp_unused);
> + if (static_branch_unlikely(&sched_uclamp_unused))
> + static_branch_disable(&sched_uclamp_unused);
That's an anti-pattern... just static_branch_disable(), or _enable()
with a 'better' name is sufficient.
Powered by blists - more mailing lists