<div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hi Xinpeng,</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Mar 5, 2021 at 1:52 PM <a href="mailto:liuxp11@chinatelecom.cn" target="_blank">liuxp11@chinatelecom.cn</a> <<a href="mailto:liuxp11@chinatelecom.cn" target="_blank">liuxp11@chinatelecom.cn</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"><div>
<div><span></span><div class="gmail_quote"><span class="gmail_default">--- a/lib/tst_memutils.c<br>+++ b/lib/tst_memutils.c<br>@@ -36,6 +36,13 @@ void tst_pollute_memory(size_t maxsize, int fillchar)<br><strike> if (info.freeram - safety < maxsize / info.mem_unit)<br> maxsize = (info.freeram - safety) * info.mem_unit;</strike><br><br></span></div><div class="gmail_quote"><span class="gmail_default"> ==>Thanks,but the maxsize original code need to be deleted,Right?<br></span></div></div></div></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">No, the maxsize code is also useful, it needs to define the value in</div><div class="gmail_default" style="font-size:small">most common situations(i.e. CommitLimit > MemAvailable).</div><br></div><div><div class="gmail_default" style="font-size:small">But I'm still hesitating to use ComitLimit as the threshold for 'maxsize'.</div><div class="gmail_default" style="font-size:small">Because according to the Linux document, it says that only take effort</div><div class="gmail_default" style="font-size:small">when overcommit_memory is setting to 2. But our test system all set 0</div><div class="gmail_default" style="font-size:small">by default.</div><div class="gmail_default" style="font-size:small"><br></div><span class="gmail_default" style="font-size:small"> </span>"This limit is only adhered to if strict overcommit accounting is enabled</div><div><span class="gmail_default" style="font-size:small"> </span>(mode 2 in 'vm.overcommit_memory')."<br></div><div><div class="gmail_default" style="font-size:small"> see:<a href="https://github.com/torvalds/linux/blob/master/Documentation/filesystems/proc.rst" target="_blank"> https://github.com/torvalds/linux/blob/master/Documentation/filesystems/proc.rst</a></div></div><div><br></div><div><div class="gmail_default" style="font-size:small">Seems to use CommitLimit looks a bit strict and strange to test.</div><br></div><div><div class="gmail_default" style="font-size:small">And I even think the way to use MemAvailable is acceptable if</div><div class="gmail_default" style="font-size:small">MemFree > MemAvailable, just like what you did in your last patch.</div><div class="gmail_default" style="font-size:small"></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">I'm still not very sure so far~</div><div class="gmail_default" style="font-size:small">(But one thing I can confirm that MemAvailable < MemFree is correct behavior sometimes)</div><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><div><div class="gmail_quote"><span class="gmail_default"><br></span></div><div class="gmail_quote"><span class="gmail_default">+ /*<br>+ * To respect CommitLimit to prevent test invoking OOM killer,<br>+ * this may appear on system with a smaller swap-disk (or disabled).<br>+ */<br>+ if (SAFE_READ_MEMINFO("CommitLimit:") < SAFE_READ_MEMINFO("MemAvailable:"))<br>+ maxsize = SAFE_READ_MEMINFO("CommitLimit:") * 1024 - (safety * info.mem_unit);<br>+<br> blocksize = MIN(maxsize, blocksize);<br> map_count = maxsize / blocksize;<br> map_blocks = SAFE_MALLOC(map_count * sizeof(void *));</span></div></div></div></blockquote><div> </div></div><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div>Regards,<br></div><div>Li Wang<br></div></div></div></div>