<div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Bala,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 9, 2019 at 5:19 PM Balamuruhan S <<a href="mailto:bala24@linux.vnet.ibm.com">bala24@linux.vnet.ibm.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail_default" style="font-size:small">[...snip...]</span><br>
> > > --- a/testcases/kernel/numa/numa01.sh<br>
> > > +++ b/testcases/kernel/numa/numa01.sh<br>
> > > @@ -52,9 +52,18 @@ TST_NEEDS_CMDS="awk bc numactl numastat"<br>
> > > extract_numastat_p()<br>
> > > {<br>
> > > local pid=$1<br>
> > > - local node=$(($2 + 2))<br>
> > > -<br>
> > > - echo $(numastat -p $pid |awk '/^Total/ {print $'$node'}')<br>
> > > + local node=$2<br>
> > > +<br>
> > > + echo $(numastat -p $pid | \<br>
> > > + awk -v node=$node '/Node/ { \<br>
> > > + gsub("Node", ""); \<br>
> > > + for (i=0; i<NF; i++) \<br>
> > > + if ($i == node) \<br>
> > > + col=i+1; \<br>
> > > + next \<br>
> > > + } \<br>
> > > + /^Total/ {print $col}' \<br>
> > > + )<br>
> > > }<br>
> ><br>
> > If we can use extract_numastat_p0 with node_index then the existing code<br>
> > works, for example if can index while iterating $node_list and use this<br>
> > with extract_numastat_p0 then it should work.<br>
> ><br>
> <br>
> Hi Bala,<br>
> <br>
> Sorry, I don't fully understand what's you mean here :(. Could you explain<br>
> something more for this method?<br>
<br>
instead of changing `extract_numastat_p0()` can do something like this ?</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
diff --git a/testcases/kernel/numa/numa01.sh b/testcases/kernel/numa/numa01.sh<br>
index 33393ac8d..47c18edd6 100755<br>
--- a/testcases/kernel/numa/numa01.sh<br>
+++ b/testcases/kernel/numa/numa01.sh<br>
@@ -94,6 +94,7 @@ setup()<br>
test1()<br>
{<br>
Mem_curr=0<br>
+ node_index=0<br>
<br>
for node in $nodes_list; do<br>
numactl --cpunodebind=$node --membind=$node support_numa alloc_1MB &<br>
@@ -101,7 +102,8 @@ test1()<br>
<br>
TST_RETRY_FUNC "check_for_support_numa $pid" 0<br>
<br>
- Mem_curr=$(echo "$(extract_numastat_p $pid $node) * $MB" |bc)<br>
+ Mem_curr=$(echo "$(extract_numastat_p $pid $node_index) * $MB" |bc)<br>
+ let node_index++<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">I guess it can be work, but the disadvantage of that is we have to involve a new variable(node_index) in each of the tests (from test1 to test10). Hence I don't think it is much better than my patch. For which way to go, I'd leave this to Cyril to make a choice. Or, maybe he has different thoughts on this:).</div></div><div> </div><div><div class="gmail_default" style="font-size:small">Anyway, thanks for your suggestion.</div></div><div class="gmail_default" style="font-size:small"><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div></div>