본문 바로가기

Enginius/Linux

DWRR_patch guideline -SJ

1. 현재 task가 round_expired 인지를 확인
 if (p->se.on_rq == rq->round_expired)

2. 현재 런큐에 들어간 task가 있는지 여부를 확인 
 if (rq->nr_running == 0)
 if (rq>round_expired->nr_running == 0) 
 
3. 현재 런큐에 수행 중인 task가 idle_task인지 여부를 확인
 if (rq->curr == rq->idle)

4. task_struct에 추가한 부분 초기화 함수
 static void __sched_fork(struct task_struct *p) 

5. sched_balance_self 함수의 변화 
 sched_balance_self 함수는 원래 현재 cpu에 돌고 있는 current task를 balance하는 함수이다. SD_BALANCE_FORK와 SD_BALANCE_EXEC를 할 때 balance를 한다. return 값은 가장 적게 loaded된 cpu number이다. 
 DWRR_patch는 이 함수를 sched_balance_task로 변경한다. 이렇게 변경을 하면서 아규먼트에 task_struct *t를 추가하고, 함수 기존에 있던 struct task_struct *t = current; 을 삭제한다.
 즉 현재 cpu의 rq의 current를 기준으로 idlest_cpu와 group을 찾던 기존의 routine을 sched_balance_task함수의 아규먼트 t를 기준으로 검색하게 변경한 것이다. 이 함수가 실제로 불리는 부분에서는 pcurrent 둘 중 하나가 들어간다. 만약 current가 들어간다면 기존의 함수와 동일하게 동작하는 것이다. 

 문제는 이 sched_balance_self 함수가 2.6.3x 버젼에서는 sched_class의 select_task_rq로 변경된 것이다. fair class의 경우 select_task_rq_fair 함수로 연결이 된다. 이 함수는 아규먼트로 *p, sd_flag, wake_flags를 갖는다. 이 부분은 DWRR_patch 의 추가된 아규먼트 t와 연결된다. 
 

'Enginius > Linux' 카테고리의 다른 글

Downloading files from "ssh" server in Linux environment  (0) 2011.09.16
Linux Kernel Compile !  (0) 2011.09.03
Real-Time class의 load_balancing  (0) 2011.08.22
"Buddy" in Linux  (0) 2011.08.22
"all_pinned logic" in Linux  (0) 2011.08.19