aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/sched_fair.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r--kernel/sched_fair.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c
index a78ed2736ba7..a608593df243 100644
--- a/kernel/sched_fair.c
+++ b/kernel/sched_fair.c
@@ -1421,7 +1421,7 @@ static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq,
1421static __always_inline void account_cfs_rq_runtime(struct cfs_rq *cfs_rq, 1421static __always_inline void account_cfs_rq_runtime(struct cfs_rq *cfs_rq,
1422 unsigned long delta_exec) 1422 unsigned long delta_exec)
1423{ 1423{
1424 if (!cfs_rq->runtime_enabled) 1424 if (!cfs_bandwidth_used() || !cfs_rq->runtime_enabled)
1425 return; 1425 return;
1426 1426
1427 __account_cfs_rq_runtime(cfs_rq, delta_exec); 1427 __account_cfs_rq_runtime(cfs_rq, delta_exec);
@@ -1429,13 +1429,13 @@ static __always_inline void account_cfs_rq_runtime(struct cfs_rq *cfs_rq,
1429 1429
1430static inline int cfs_rq_throttled(struct cfs_rq *cfs_rq) 1430static inline int cfs_rq_throttled(struct cfs_rq *cfs_rq)
1431{ 1431{
1432 return cfs_rq->throttled; 1432 return cfs_bandwidth_used() && cfs_rq->throttled;
1433} 1433}
1434 1434
1435/* check whether cfs_rq, or any parent, is throttled */ 1435/* check whether cfs_rq, or any parent, is throttled */
1436static inline int throttled_hierarchy(struct cfs_rq *cfs_rq) 1436static inline int throttled_hierarchy(struct cfs_rq *cfs_rq)
1437{ 1437{
1438 return cfs_rq->throttle_count; 1438 return cfs_bandwidth_used() && cfs_rq->throttle_count;
1439} 1439}
1440 1440
1441/* 1441/*
@@ -1756,6 +1756,9 @@ static void __return_cfs_rq_runtime(struct cfs_rq *cfs_rq)
1756 1756
1757static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq) 1757static __always_inline void return_cfs_rq_runtime(struct cfs_rq *cfs_rq)
1758{ 1758{
1759 if (!cfs_bandwidth_used())
1760 return;
1761
1759 if (!cfs_rq->runtime_enabled || cfs_rq->nr_running) 1762 if (!cfs_rq->runtime_enabled || cfs_rq->nr_running)
1760 return; 1763 return;
1761 1764
@@ -1801,6 +1804,9 @@ static void do_sched_cfs_slack_timer(struct cfs_bandwidth *cfs_b)
1801 */ 1804 */
1802static void check_enqueue_throttle(struct cfs_rq *cfs_rq) 1805static void check_enqueue_throttle(struct cfs_rq *cfs_rq)
1803{ 1806{
1807 if (!cfs_bandwidth_used())
1808 return;
1809
1804 /* an active group must be handled by the update_curr()->put() path */ 1810 /* an active group must be handled by the update_curr()->put() path */
1805 if (!cfs_rq->runtime_enabled || cfs_rq->curr) 1811 if (!cfs_rq->runtime_enabled || cfs_rq->curr)
1806 return; 1812 return;
@@ -1818,6 +1824,9 @@ static void check_enqueue_throttle(struct cfs_rq *cfs_rq)
1818/* conditionally throttle active cfs_rq's from put_prev_entity() */ 1824/* conditionally throttle active cfs_rq's from put_prev_entity() */
1819static void check_cfs_rq_runtime(struct cfs_rq *cfs_rq) 1825static void check_cfs_rq_runtime(struct cfs_rq *cfs_rq)
1820{ 1826{
1827 if (!cfs_bandwidth_used())
1828 return;
1829
1821 if (likely(!cfs_rq->runtime_enabled || cfs_rq->runtime_remaining > 0)) 1830 if (likely(!cfs_rq->runtime_enabled || cfs_rq->runtime_remaining > 0))
1822 return; 1831 return;
1823 1832