<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 27, 2015 at 2:05 AM, Alexey Kodanev <span dir="ltr"><<a href="mailto:alexey.kodanev@oracle.com" target="_blank">alexey.kodanev@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br><div bgcolor="#FFFFFF" text="#000000">
Hi,<span class=""><br>
<div>On 11/26/2015 03:25 PM, Li Wang wrote:<br>
</div>
...<br></span>
OK, but I meant that either we need to remove "sz" variable and use
"i * hpage_size" or<br>
make it straightforward as "i" doesn't influence on the actual size
passed to mmap and threads.<br>
<br>
So that both of the loops looks the same.<br>
<br>
Also to use the full range of declared arrays, we should do as
follows or declare them as ARSZ - 1:<br>
<br>
struct mp mmap_sz[ARSZ];<br>
pthread_t tid[ARSZ];<br>
<br>
sz = ARSZ + 1;<br>
<br>
...<br>
<br>
for (i = 0; i < ARSZ; ++i, --sz) {<span class=""><br>
mmap_sz[i].sz = sz;<br></span><span class="">
mmap_sz[i].addr = addr;<br></span>
...<br>
}<br>
<br>
for (i = 0; i < ARSZ; ++i) {<br>
pthread_join(...);<div><div class="h5"><br>
}<br></div></div></div></blockquote><div><br>looks like this form is better. thanks!<br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div><div class="h5"><br><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+ mmap_sz[i].sz = sz;<br>
+ mmap_sz[i].addr = addr;<br>
+<br>
+ TEST(pthread_create(tid + i, NULL,
thr, &mmap_sz[i]));<br>
</blockquote>
<br>
</span>
This is not right, use tid[i] ( = tid + sizeof(pthread_t)
* i), not tid + i.<span><br>
</span></blockquote>
<div><br>
sorry, probably you want say this:<br>
<br>
(pthread_t *)((char *)tid + sizeof(pthread_t) * i)<br>
<br>
but I think the original way is right.<br>
</div>
</div>
</div>
</div>
</blockquote>
<br></div></div>
Yes, you are right, sorry for misleading you.<br>
<br>
I would recommend to use the same style in one function, so<br>
<br>
<span>TEST(pthread_create(tid + i, NULL, thr, mmap_sz + i));<br>
or </span><br>
<span>TEST(pthread_create(&tid[i], NULL, thr, &mmap_sz[i]));</span><br></div></blockquote><div><br></div><div>yeah, it is more neatly. agreed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div><div class="h5"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>
...<br>
<br>
/* Call tst_flush() flush any output in the buffer. */<br>
tst_flush();<br>
<br>
/* Mask out TINFO result from the exit status. */<br>
exit(T_exitval & ~TINFO);<br>
}<br>
<br>
</div>
<div>I didn't saw there anyplace call the cleanup()
function. :(<br>
</div>
</div>
</div>
</div>
</blockquote>
<br></div></div>
Right, I've read the mail thread recently about changing cleanup()
to be declared as a signal handler before<br>
and somehow thought it is already implemented in LTP...<br>
<br>
Thanks,<br>
Alexey<br>
<br>
</div>
</blockquote></div><br>ok, let me post patch v3.<br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div>Regards,<br></div>Li Wang<br></div><div>Email: <a href="mailto:liwang@redhat.com" target="_blank">liwang@redhat.com</a><br></div></div></div></div></div></div>
</div></div>