手机版
你好,游客 登录 注册
背景:
阅读新闻

Linux I/O Scheduler--CFQ(上)

[日期:2012-12-16] 来源:Linux社区  作者:vanbreaker [字体:大 中 小]

queue:指向块设备对应的request_queue

service_tree:所有待调度的队列都被添加进该红黑树,等待调度获取时间片

prio_trees[CFQ_PRIO_LISTS]:对应8个优先级的红黑树,所有优先级类别为RT或BE的进程的同步请求队列,都会根据优先级添加至相应的红黑树

busy_queues:用于计算service_tree中有多少个队列在等待调度

active_queue:指向当前占有块设备的队列

async_cfqq[2][IOPRIO_BE_NR]:对应RT和BE优先级类的16个异步请求队列

async_idle_cfqq:对应优先级类别为IDLE的异步请求队列

cfq_quantum:用于计算在一个队列的时间片内,最多发放多少个请求到底层的块设备

cfq_fifo_expire[2]:同步、异步请求的响应期限时间

cfq_slice[2]:同步、异步请求队列的时间片长度

struct cfq_queue {
 /* reference count */
 atomic_t ref;
 /* various state flags, see below */
 unsigned int flags;
 /* parent cfq_data */
 struct cfq_data *cfqd;
 /* service_tree member */
 struct rb_node rb_node;
 /* service_tree key */
 unsigned long rb_key;
 /* prio tree member */
 struct rb_node p_node; 
 /* prio tree root we belong to, if any */
 struct rb_root *p_root;
 /* sorted list of pending requests */
 struct rb_root sort_list;
 /* if fifo isn't expired, next request to serve */
 struct request *next_rq;
 /* requests queued in sort_list */
 int queued[2];
 /* currently allocated requests */
 int allocated[2];
 /* fifo list of requests in sort_list */
 struct list_head fifo;   

 unsigned long slice_end;
 long slice_resid;
 unsigned int slice_dispatch;

 /* pending metadata requests */
 int meta_pending;
 /* number of requests that are on the dispatch list or inside driver */
 int dispatched;

 /* io prio of this group */
 unsigned short ioprio, org_ioprio;
 unsigned short ioprio_class, org_ioprio_class;

 unsigned int seek_samples;
 u64 seek_total;
 sector_t seek_mean;
 sector_t last_request_pos;
 unsigned long seeky_start;

 pid_t pid;

 struct cfq_queue *new_cfqq;
};

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款