- 論壇徽章:
- 1
|
10可用積分
我的想法是故意地減少I(mǎi)O進(jìn)程的運(yùn)行時(shí)間:修改代碼如下
static inline void
__update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr,
unsigned long delta_exec)
{
unsigned long delta_exec_weighted;
struct task_struct *my_p;
+ my_p = task_of(curr);
schedstat_set(curr->exec_max, max((u64)delta_exec, curr->exec_max));
//判斷當(dāng)前進(jìn)程是不是IO進(jìn)程
+ if(my_p->ioac.write_bytes > 0){
//是IO進(jìn)程則減慢vruntime的增長(zhǎng)
+ if(count_io > 1){
+ curr->sum_exec_runtime += delta_exec;
+ schedstat_add(cfs_rq, exec_clock, delta_exec);
+ delta_exec_weighted = calc_delta_fair(delta_exec, curr);
+ curr->vruntime += delta_exec_weighted;
+ count_io --;
+ if (entity_is_task(curr)) { //組調(diào)度策略由update_curr函數(shù)移到這里做一個(gè)控制
+ struct task_struct *curtask = task_of(curr);
+ cpuacct_charge(curtask, delta_exec);
+ account_group_exec_runtime(curtask, delta_exec);
+ }
+ }else{//運(yùn)行IO進(jìn)程后不作記賬
+ schedstat_add(cfs_rq, exec_clock, delta_exec);
+ count_io++;
+ }
+ }else{//不是IO進(jìn)程則正常運(yùn)行
+ curr->sum_exec_runtime += delta_exec;
+ schedstat_add(cfs_rq, exec_clock, delta_exec);
+ delta_exec_weighted = calc_delta_fair(delta_exec, curr);
+ curr->vruntime += delta_exec_weighted;
+ if (entity_is_task(curr)) {
+ struct task_struct *curtask = task_of(curr);
+ cpuacct_charge(curtask, delta_exec);
+ account_group_exec_runtime(curtask, delta_exec);
+ }
+ }
update_min_vruntime(cfs_rq);
}
static void update_curr(struct cfs_rq *cfs_rq)
{
struct sched_entity *curr = cfs_rq->curr;
u64 now = rq_of(cfs_rq)->clock;
unsigned long delta_exec;
if (unlikely(!curr))
return;
/*
* Get the amount of time the current task was running
* since the last time we changed load (this cannot
* overflow on 32 bits):
*/
delta_exec = (unsigned long)(now - curr->exec_start);
__update_curr(cfs_rq, curr, delta_exec);
curr->exec_start = now;
- if (entity_is_task(curr)) {//移到__update_curr函數(shù)中控制運(yùn)行
- struct task_struct *curtask = task_of(curr);
- cpuacct_charge(curtask, delta_exec);
- account_group_exec_runtime(curtask, delta_exec);
- }
}
修改后性能并沒(méi)有提升,請(qǐng)各位大神給點(diǎn)自己的意見(jiàn),謝謝 |
最佳答案
查看完整內(nèi)容
此類問(wèn)題建議從業(yè)務(wù)模型方面優(yōu)化,效果可能更明顯,比如綁核,專核用于IO。。
|