For analysis purposes.
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped - Build Status
Buildable 63842 Build 60726: arc lint + arc unit
Event Timeline
sys/kern/vfs_cache.c | ||
---|---|---|
602 | These aren't very useful, as they don't reflect the actual allocation size. That can be obtained from vmstat -z, and more detailed info is under the vm.uma sysctl. It's also easy to get similar info from ctfdump or debug info (e.g. with gdb's ptype/o). Why add yet another thing? |
sys/kern/vfs_cache.c | ||
---|---|---|
602 | Seconded this opinion. Never used the debug.sizeof, gdb 'p/x sizeof(struct)' was enough, and with the pahole support gdb is all what I need. In fact, it might make sense to remove the whole debug.sizeof subtree to slightly reduce the bloat. |
sys/kern/vfs_cache.c | ||
---|---|---|
602 | At least debug.sizeof.znode is used (by libprocstat, and it's a hack). For compatibility it's probably better to retain them, but again I don't see the value in expanding the tree. We should always prefer to avoid making kernel structure layout visible to userspace. |
sys/kern/vfs_cache.c | ||
---|---|---|
602 |
Then, I'll just give up this revision.
Oh, simply because it didn't occur to me I could do that. :-) And I didn't know about ptype/o, *very* useful.
The point is not to make kernel structure layout visible, but to easily get info on structure sizes, for various reasons (see also the other revisions in this stack). This is in fact what vmstat -z for structures allocated from zones does.
No doubt that all memory allocation mechanisms have overhead. However, not sure why you're saying that, as the size reported by vmstat -z is (unsurprisingly) exactly sizeof(struct) (which includes end of struct padding), and the allocator's overhead doesn't seem to be reported, except for internal fragmentation through the efficiency leaves (which I've just discovered). |
sys/kern/vfs_cache.c | ||
---|---|---|
602 |
Note that there is a flexible array at the end of struct namecache. We define two UMA zones for namecache entries, "S VFS Cache" and "L VFS Cache", to reduce internal fragmentation. The former is for "short" paths which represent the common case. The zone size represents the actual allocation size, i.e. sizeof(struct namecache) + name length. Which vmstat -z entry are you looking at? |
sys/kern/vfs_cache.c | ||
---|---|---|
602 | I was looking at struct vm_object and struct vnode as examples when I wrote this. Right, it's best to have the final result than having to do the maths by hand in such cases. |