在2.6.21以前的内核中有一个函数dependent_sleeper,该函数的意义就是,在schedule中,如果当前cpu的运行队列的进程数量不为0,那么还是不能简单的从这个队列中选择一个最高优先级的进程,而是要看看这个cpu是否拥有一个逻辑兄弟cpu,然后抉择,这种情况在intel的超线程中是可能的,由于超线程共享运算逻辑,而仅仅实现了两套寄存器组和中断控制逻辑,两个逻辑cpu共享一个mmu(影响tlb)和cache,导致两个cpu同时运行而共用那些东西的话效率很差,这么说来超线程的设计就是一个错误,linux认识了这种错误,于是就有了dependent_sleeper这个函数,它的策略是,如果兄弟cpu上运行着一个比要选择进程优先级高的进程,如果是就不能打扰这个正运行的进程,第一,人家优先级高;第二,人家的缓存和tlb还热着呢。
这个特性曾经一度让我着迷,linux内核设计得简直滴水不漏,可是我在沉迷于这种快感的同时忽视了linux的另一个热性:如果作用不大,任何花哨的功夫都将被砍去,如果说超线程是个错误的话,为何让内核去迎合它呢?如果是个错误的话,用户不要选择这样的cpu就是了,根本没有必要在schedule中插入这一段仅仅为了超线程的代码,因此在很多的机器上,dependent_sleeper这个函数其实是没有用的,因此2.6.21中终于被砍去了,被砍去的原因除了上述原因之外,内核社区的所谓的官方原因就是:
Remove the SMT-nice feature which idles sibling cpus on SMT cpus to facilitiate nice working properly where cpu power is shared. The idling of cpus in the presence of runnable tasks is considered too fragile, easy to break with outside code, and the complexity of managing this system if an architecture comes along with many logical cores sharing cpu power will be unworkable.
上面的描述是够详细了,idle进程十分的脆弱,任何的执行绪都可以打断它,如果兄弟cpu上运行着一个高优先级进程导致这个cpu上只能运行idle的话,那么就会导致这个idle会被不间断的打断,每次中断都会设置idle的调度标志,这样的话,idle就像一个无聊的把门者,明明大门敞开,仅仅因为屋里有一个比自己胖的食客就拒人于门外,这实在不公平,超线程岂不是成了摆设,好像开了几扇门却只有一个门让大众过,别的都成了官道,事实是,民众永远都是最多的。
分享到:
相关推荐
SMDK2416 Linux 2.6.21_WDT InstallationManual REV1_00 supports S3C2416 and its series too...
SMDK2416_Linux_2.6.21_SPI InstallationManual REV1 supporting S3C2416 and many S3C series also...
SMDK2416 Linux_2.6.21 Docs
linux-2.6.21 内核 基于arm_s3c2440
smarty2.6.21........................
本文件包含芯片为RTL8188的WIFI在硬件为S3C2416、Linux2.6.21上的移植过程,包含WIFI源代码。
2.6.21内核的安装指导 This document is the software release notes, which describe the packages for the PXA310 Handheld Platform Development Kit for mobile Linux® (handheld platform), A2 stepping. The ...
Smarty 最好用的PHP模板 Smarty是一个使用PHP写出来的模板PHP模板引擎,是目前业界最著名的PHP模板引擎之一。它分离了逻辑代码和外在的内容,提供了一种易于管理和使用的方法,用来将原本与HTML代码混杂在一起PHP...
Marked是一款用于实时预览多种类型的文档(markdown,html等)的实用工具,它有全套的自定义选项和预览样式,无论您使用任何编辑器修改并保存文档,都可以在Marked上实时看到最新的效果。 ... Marked能如实反映你的文档...
自己编译的2.6.21.5内核 386和586两个版本
安装方法: mkdir /opt/src&& tar -xzf libxml2-2.7.8.tar.gz \ && cd /opt/src/libxml2-2.7.8 \ && ./configure && make && make install \ && cd /opt/src \ && tar -xzf libxslt-1.1.26.tar.gz \ ...
Linux-2.6.20内核移植到AT91RM9200-EK
o linux-2.6.21.x : Linux kernel source for RT3052 o romfs : root file system (uncompressed) o tools : useful script to generate rootfs o user : user applications o vendor : init scripts of target ...
o linux-2.6.21.x : Linux kernel source for RT3052 o romfs : root file system (uncompressed) o tools : useful script to generate rootfs o user : user applications o vendor : init scripts of target ...
atmel arm9 linux-2.6.22 exp patch
o linux-2.6.21.x : Linux kernel source for RT3052 o romfs : root file system (uncompressed) o tools : useful script to generate rootfs o user : user applications o vendor : init scripts of target ...
o linux-2.6.21.x : Linux kernel source for RT3052 o romfs : root file system (uncompressed) o tools : useful script to generate rootfs o user : user applications o vendor : init scripts of target ...
linux 2.6.21 arp proxy 用于arp代理,可以修改后做其它机器的代理
linux网络数据包走向图(2.6.21)
1.linux2.6.21 2.pxa310