diff options
Diffstat (limited to 'kernel/sched_fair.c')
-rw-r--r-- | kernel/sched_fair.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/sched_fair.c b/kernel/sched_fair.c index 566e3bb78ed9..cd73738f0d5f 100644 --- a/kernel/sched_fair.c +++ b/kernel/sched_fair.c | |||
@@ -1938,6 +1938,25 @@ static void moved_group_fair(struct task_struct *p) | |||
1938 | } | 1938 | } |
1939 | #endif | 1939 | #endif |
1940 | 1940 | ||
1941 | unsigned int get_rr_interval_fair(struct task_struct *task) | ||
1942 | { | ||
1943 | struct sched_entity *se = &task->se; | ||
1944 | unsigned long flags; | ||
1945 | struct rq *rq; | ||
1946 | unsigned int rr_interval = 0; | ||
1947 | |||
1948 | /* | ||
1949 | * Time slice is 0 for SCHED_OTHER tasks that are on an otherwise | ||
1950 | * idle runqueue: | ||
1951 | */ | ||
1952 | rq = task_rq_lock(task, &flags); | ||
1953 | if (rq->cfs.load.weight) | ||
1954 | rr_interval = NS_TO_JIFFIES(sched_slice(&rq->cfs, se)); | ||
1955 | task_rq_unlock(rq, &flags); | ||
1956 | |||
1957 | return rr_interval; | ||
1958 | } | ||
1959 | |||
1941 | /* | 1960 | /* |
1942 | * All the scheduling class methods: | 1961 | * All the scheduling class methods: |
1943 | */ | 1962 | */ |
@@ -1966,6 +1985,8 @@ static const struct sched_class fair_sched_class = { | |||
1966 | .prio_changed = prio_changed_fair, | 1985 | .prio_changed = prio_changed_fair, |
1967 | .switched_to = switched_to_fair, | 1986 | .switched_to = switched_to_fair, |
1968 | 1987 | ||
1988 | .get_rr_interval = get_rr_interval_fair, | ||
1989 | |||
1969 | #ifdef CONFIG_FAIR_GROUP_SCHED | 1990 | #ifdef CONFIG_FAIR_GROUP_SCHED |
1970 | .moved_group = moved_group_fair, | 1991 | .moved_group = moved_group_fair, |
1971 | #endif | 1992 | #endif |