-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
代码缺陷! #37
Comments
union shm_hentry_offset { segment index是16位啊! |
0x4000为占位符。 |
按entry->memory.index.segment | 0x4000作为占位符,我理解低14位都是可用的,但是conv.segment.index & 0xFF这里只使用了低8位啊,说明目前只有255字节是可以用的。所以我理解0xFF是不是写错了,应该是0xFFFF,当时在阅读代码的时候一直纳闷0xFF是16位? |
段地址index 16位,offset 48位段内偏移这个是没有问题的。conv.segment.index & 0xFF这里只拿了低8位,也就是目前只支持了最大127个段,因为int有符号。 |
这里实际上分配的时候才有striping的概念,但是寻址实际还是只有段的概念。 |
static inline struct shm_hash_entry *shm_get_hentry_ptr(struct shmcache_context *context,
const int64_t offset)
{
···
base = shmopt_get_value_segment(context, conv.segment.index & 0xFF);
···
}
static inline int64_t shm_get_hentry_offset(struct shm_hash_entry *entry)
{
···
conv.segment.index = entry->memory.index.segment | 0x4000;
···
}
为什么段segment index只用了8位,代表段数最多只能是255,设置段地址|0x4000也是看不懂什么操作!
The text was updated successfully, but these errors were encountered: