Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
`YIELD_MARK` only applies if `cfs_rq->h_nr_running > 1`
`YIELD_UNMARK` on migrate_task
  • Loading branch information
hamadmarri committed Nov 16, 2021
1 parent f108315 commit dacba58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
8 changes: 3 additions & 5 deletions kernel/sched/bs.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ unsigned int __read_mostly tt_max_lifetime = 22000; // in ms
#define RACE_TIME 40000000
#define FACTOR (RACE_TIME / HZ_PERIOD)

#define YIELD_MARK(ttn) ((ttn)->vruntime |= 0x8000000000000000ULL)
#define YIELD_UNMARK(ttn) ((ttn)->vruntime &= 0x7FFFFFFFFFFFFFFFULL)

#define IS_REALTIME(ttn) ((ttn)->task_type == TT_REALTIME)
#define IS_INTERACTIVE(ttn) ((ttn)->task_type == TT_INTERACTIVE)
#define IS_NO_TYPE(ttn) ((ttn)->task_type == TT_NO_TYPE)
Expand Down Expand Up @@ -418,14 +415,15 @@ static void yield_task_fair(struct rq *rq)
struct task_struct *curr = rq->curr;
struct cfs_rq *cfs_rq = task_cfs_rq(curr);

YIELD_MARK(&curr->se.tt_node);

/*
* Are we the only task in the tree?
*/
if (unlikely(rq->nr_running == 1))
return;

if (cfs_rq->h_nr_running > 1)
YIELD_MARK(&curr->se.tt_node);

if (curr->policy != SCHED_BATCH) {
update_rq_clock(rq);
/*
Expand Down
7 changes: 4 additions & 3 deletions kernel/sched/bs.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#define YIELD_MARK(ttn) ((ttn)->vruntime |= 0x8000000000000000ULL)
#define YIELD_UNMARK(ttn) ((ttn)->vruntime &= 0x7FFFFFFFFFFFFFFFULL)

/*
* After fork, child runs first. If set to 0 (default) then
Expand Down Expand Up @@ -44,13 +46,12 @@ static void migrate_task_rq_fair(struct task_struct *p, int new_cpu)
*/
remove_entity_load_avg(&p->se);
}

/* We have migrated, no longer consider this task hot */
p->se.exec_start = 0;
#endif
/* Tell new CPU we are migrated */
p->se.avg.last_update_time = 0;

YIELD_UNMARK(&p->se.tt_node);

update_scan_period(p, new_cpu);
}

Expand Down

0 comments on commit dacba58

Please sign in to comment.