@@ -3240,6 +3240,19 @@ static inline unsigned long cpu_util_rt(struct rq *rq)
32403240
32413241unsigned long uclamp_eff_value (struct task_struct * p , enum uclamp_id clamp_id );
32423242
3243+ /*
3244+ * When uclamp is compiled in, the aggregation at rq level is 'turned off'
3245+ * by default in the fast path and only gets turned on once userspace performs
3246+ * an operation that requires it.
3247+ *
3248+ * Returns true if userspace opted-in to use uclamp and aggregation at rq level
3249+ * hence is active.
3250+ */
3251+ static inline bool uclamp_is_used (void )
3252+ {
3253+ return static_branch_likely (& sched_uclamp_used );
3254+ }
3255+
32433256static inline unsigned long uclamp_rq_get (struct rq * rq ,
32443257 enum uclamp_id clamp_id )
32453258{
@@ -3263,7 +3276,7 @@ static inline bool uclamp_rq_is_capped(struct rq *rq)
32633276 unsigned long rq_util ;
32643277 unsigned long max_util ;
32653278
3266- if (!static_branch_likely ( & sched_uclamp_used ))
3279+ if (!uclamp_is_used ( ))
32673280 return false;
32683281
32693282 rq_util = cpu_util_cfs (cpu_of (rq )) + cpu_util_rt (rq );
@@ -3272,19 +3285,6 @@ static inline bool uclamp_rq_is_capped(struct rq *rq)
32723285 return max_util != SCHED_CAPACITY_SCALE && rq_util >= max_util ;
32733286}
32743287
3275- /*
3276- * When uclamp is compiled in, the aggregation at rq level is 'turned off'
3277- * by default in the fast path and only gets turned on once userspace performs
3278- * an operation that requires it.
3279- *
3280- * Returns true if userspace opted-in to use uclamp and aggregation at rq level
3281- * hence is active.
3282- */
3283- static inline bool uclamp_is_used (void )
3284- {
3285- return static_branch_likely (& sched_uclamp_used );
3286- }
3287-
32883288#define for_each_clamp_id (clamp_id ) \
32893289 for ((clamp_id) = 0; (clamp_id) < UCLAMP_CNT; (clamp_id)++)
32903290
0 commit comments