fix typo in ethr_aux.c

xyf <[email protected]>
Newsgroups gmane.comp.lang.erlang.bugs
Message-ID <[email protected]>
Hi,


It seems there is a typo in file ethr_aux.c,  function ts_event_pool(int size, ethr_ts_event **endpp) tries to
allocate memory at cache line boundary, but the code wrongly detects it, please see attachments,
further, you only needs to allocate extra cache_line_size -1 bytes but not full cache line, because most bytes
you should skip is cache_line_size - 1, patch file ethr_aux.c.diff2 fixed it.


Regards,
Yifeng Xu

_______________________________________________
erlang-bugs mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-bugs
ethr_aux.c.diff (application/octet-stream, 465 B)
--- erts\lib_src\common\ethr_aux.c.old	2014-04-08 02:31:32 +0800
+++ erts\lib_src\common\ethr_aux.c	2014-06-04 09:01:34 +0800
@@ -363,7 +363,7 @@
 				 + ETHR_CACHE_LINE_SIZE);
     if (!atsev)
 	return NULL;
-    if ((((ethr_uint_t) atsev) & ETHR_CACHE_LINE_MASK) == 0)
+    if ((((ethr_uint_t) atsev) & ETHR_CACHE_LINE_MASK) != 0)
 	atsev = ((ethr_aligned_ts_event *)
 		 ((((ethr_uint_t) atsev) & ~ETHR_CACHE_LINE_MASK)
 		  + ETHR_CACHE_LINE_SIZE));
ethr_aux.c.diff2 (application/octet-stream, 624 B) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.