tag:blogger.com,1999:blog-5171098727364395242.post7411755585113201055..comments2023-05-14T13:23:31.669+01:00Comments on Psychosomatic, Lobotomy, Saw: Direct Memory Alignment in JavaNitsanhttp://www.blogger.com/profile/10496299147100350513noreply@blogger.comBlogger6125tag:blogger.com,1999:blog-5171098727364395242.post-19773439060122873492018-05-14T10:11:55.495+01:002018-05-14T10:11:55.495+01:00"sz = align_up(sz, HeapWordSize);" impli..."sz = align_up(sz, HeapWordSize);" implies to me that the allocation is word aligned, not size aligned. Common case is aligned to 8 bytes, which means that being page/cache line aligned is the user's problem.<br />As for doing nothing special for malloc, I assume this is relying on the malloc contract.Nitsanhttps://www.blogger.com/profile/10496299147100350513noreply@blogger.comtag:blogger.com,1999:blog-5171098727364395242.post-18083567532033465272018-04-10T19:44:20.699+01:002018-04-10T19:44:20.699+01:00Nice, that old blog post is still good.
Looking i...Nice, that old blog post is still good.<br /><br />Looking into the code of openjdk - http://hg.openjdk.java.net/jdk10/jdk10/hotspot/file/5ab7a67bc155/src/share/vm/prims/unsafe.cpp#l503 - it is obvious that the size is aligned - but a bit unclear how does address is getting aligned ? <br /><br />don't see any (obvious) tricks of address alignment in os:malloc as well http://hg.openjdk.java.net/jdk10/jdk10/hotspot/file/5ab7a67bc155/src/share/vm/runtime/os.cpp#l649 <br /><br />Vladimir Dolzhenkohttps://www.blogger.com/profile/09353866985268525403noreply@blogger.comtag:blogger.com,1999:blog-5171098727364395242.post-29494554889936463222016-08-14T19:06:17.853+01:002016-08-14T19:06:17.853+01:00You need s/Theorem/Conjecture/g
A theorem is a lo...You need s/Theorem/Conjecture/g<br /><br />A theorem is a logically established statement that has nothing to do with empirical testing. A conjecture is a statement that has not yet been established either logically or empirically.<br /><br />You might also use "theory", but I think that your theory is your mental model of how memory works and the three statements that you (very nicely) test here are more consequences of the theory. You might also call them predictions instead of conjectures since conjecture is often used to refer to a statement that is likely to become a theoreM.<br /><br />Also, a theoretical prediction that is verified by experiment is often called a "fact". Useful term that, if used correctly.<br /><br />Overall this is a great bit of work, regardless of terminological quibbles like this one.Ted Dunning ... apparently Bayesianhttps://www.blogger.com/profile/02498665124454933570noreply@blogger.comtag:blogger.com,1999:blog-5171098727364395242.post-83729522953298948512014-10-19T07:57:19.108+01:002014-10-19T07:57:19.108+01:00I'm not sure I follow...
1. "Cache entry ...I'm not sure I follow...<br />1. "Cache entry is split into typically 4 parts" - Cache entry is cache line + tag, can you explain the 4 parts?<br />2. "if you cross the boundaries, which is typically 16 bytes." - is this between parts of the cache line? are you suggesting cache lines are 16 bytes long?<br />3. How would large pages effect the behaviour of CPU cache?Nitsanhttps://www.blogger.com/profile/10496299147100350513noreply@blogger.comtag:blogger.com,1999:blog-5171098727364395242.post-73181724101076222482014-10-19T07:25:16.232+01:002014-10-19T07:25:16.232+01:00Cache entry is split into typically 4 parts for re...Cache entry is split into typically 4 parts for reading them, it may also affect performance if you cross the boundaries, which is typically 16 bytes. I didn't test your code, but are you sure it is not the reason for the performance drop ?<br />Another option is that you should preferably use large pages, for more consistent results.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-5171098727364395242.post-83384892729737847492013-07-29T18:22:36.625+01:002013-07-29T18:22:36.625+01:00Thanks, very valuable information. I have been won...Thanks, very valuable information. I have been wondering for some time why I could not reproduce effects of alignment .. in fact it was mostly contraproductive due to larger data size and therefore slightly higher cache miss rate :-)Rüdiger Möllerhttps://www.blogger.com/profile/03711813786574992852noreply@blogger.com