- 论坛徽章:
- 2
|
原帖由 xie_minix 于 2006-5-25 18:11 发表
mirnshi:
我猜想,开发POLLING的团队有问题.他们对MUTEX的了解不够,最起码在5.3版本时.
这是最要命的事情.
其次,写代码时没经过思考(请原谅我这么说,他们也不容易),比如你看:
5.3版本
poll_idle(void)中
mtx ...
6.x中的代码,不同呀。主版本3、5都不是很好,命短。
- /*
- * ether_poll is called from the idle loop.
- */
- void
- ether_poll(int count)
- {
- int i;
- NET_LOCK_GIANT();
- mtx_lock(&poll_mtx);
- if (count > poll_each_burst)
- count = poll_each_burst;
- for (i = 0 ; i < poll_handlers ; i++)
- pr[i].handler(pr[i].ifp, POLL_ONLY, count);
- mtx_unlock(&poll_mtx);
- NET_UNLOCK_GIANT();
- }
- static void
- poll_idle(void)
- {
- struct thread *td = curthread;
- struct rtprio rtp;
- rtp.prio = RTP_PRIO_MAX; /* lowest priority */
- rtp.type = RTP_PRIO_IDLE;
- mtx_lock_spin(&sched_lock);
- rtp_to_pri(&rtp, td->td_ksegrp);
- mtx_unlock_spin(&sched_lock);
- for (;;) {
- if (poll_in_idle_loop && poll_handlers > 0) {
- idlepoll_sleeping = 0;
- ether_poll(poll_each_burst);
- mtx_lock_spin(&sched_lock);
- mi_switch(SW_VOL, NULL);
- mtx_unlock_spin(&sched_lock);
- } else {
- idlepoll_sleeping = 1;
- tsleep(&idlepoll_sleeping, 0, "pollid", hz * 3);
- }
- }
- }
复制代码
个人感觉,还是扔掉5.x吧,因为当初粗粗看了5.x,就觉得是个试验品,就没有仔细看,一直在4.x上做。6.1出来了,应该算是稳定住了 |
|