3 ms·
Yeah, using syscall to get uniqueId is kind of controversial...
by ZeppelinPL 9y ago
Yeah, using syscall to get uniqueId is kind of controversial...
- deleted 9y ago[deleted]
- gizmo 9y agoYou don't do a syscall for _every_ uniqueId, only once every PAGE_SIZE. It's not that expensive. Not every object needs a unique identifier. Objects that need them tend to be larger and have indeterminate lifecycles. Otherwise the overhead of storing a unique id would by itself be egregious, regardless of the process of generating the id. If you can afford to store the id then you can afford the overhead of an occasional syscall.
- amscanne 9y agoThere are secondary effects that also make this not a great idea. You may wind up slowing leaking vmas (the kernel needs to track what’s been mapped, even if it doesn’t allocate physical pages). This makes future mmap calls and page faults slower. Generating a uniqueID is trivial and super fast (one atomic operation). What’s the benefit here?