QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1435|回复: 9

about defining PIDHASH_SZ

[复制链接]
发表于 2003-5-9 11:21:11 | 显示全部楼层 |阅读模式
PIDHASH_SZ is defined in include/linux/sched.h:

#define PIDHASH_SZ (4096>>2)

why not just "#define PIDHASH_SZ 1024"?
发表于 2003-5-9 11:55:25 | 显示全部楼层
hehe, who know. i guess they want to change it to a dynamic one.
回复

使用道具 举报

 楼主| 发表于 2003-5-9 13:14:29 | 显示全部楼层
我想
仅仅是为了在这个数前边加上两个0,保证它一定是个正数
但是,有这必要吗?
回复

使用道具 举报

发表于 2003-5-9 21:38:01 | 显示全部楼层
no, if u define 1024, it will be a positive number as well.
回复

使用道具 举报

 楼主| 发表于 2003-5-11 14:45:15 | 显示全部楼层
查了一些资料,终于明白了:
4096为一个页面大小,一个指针需要一个双字,所以要右移2,也就是除以4,这样,一个散列表占用了1个页面
可以修改这个4096来使散列表占用两个以上的页面,这样,可以同时进行散列的进程就更多。
为了修改的方便,这里用4096>>2来代替1024
回复

使用道具 举报

发表于 2003-5-11 22:05:06 | 显示全部楼层
my opinion
1) since linux/sched.h is a platform netural header. it can not assume the page size is 4k. on non-x86 system, page size is different. and even x86 has huge page.
2) the number of processes can operate on hash table is decided by lock, not hash table size. even a very small hash table can have many rlock on it, while a very large hash table can still have a write lock on it.
回复

使用道具 举报

 楼主| 发表于 2003-5-15 10:58:37 | 显示全部楼层
this section can be found in Linux kernel v2.4.0
but can't be found in Linux kernel v2.4.18

why?
回复

使用道具 举报

发表于 2003-5-15 11:15:35 | 显示全部楼层
[quote:4653960e70="吴文官"]this section can be found in Linux kernel v2.4.0
but can't be found in Linux kernel v2.4.18

why?[/quote]

i can find
#define PIDHASH_SZ (4096 >> 2)
in 2.4.18
which 2.4.18 u mean? rh one?
回复

使用道具 举报

 楼主| 发表于 2003-5-15 12:14:42 | 显示全部楼层
oh
sorry
it is 2.4.20-8
rh 9
回复

使用道具 举报

发表于 2003-5-15 22:01:52 | 显示全部楼层
yes, rh changes so many. so maybe checking the patch redhat made to linux kernel can know current kernel problem and learn more.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-11-16 07:02 , Processed in 0.093765 second(s), 16 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表