<html><head><meta http-equiv="content-type" content="text/html; charset=UTF-8"><style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }div.FoxDiv20210324172018095240 { }body { font-size: 14px; font-family: 'Microsoft YaHei UI'; color: rgb(0, 0, 0); line-height: 1.5; }</style></head><body>
<div><span></span></div><blockquote style="margin-Top: 0px; margin-Bottom: 0px; margin-Left: 0.5em; margin-Right: inherit"><div>Hi Li Wang,</div><div>I think your patch is good.</div><div><span style="font-size: small; line-height: 19.5px; background-color: transparent;">1.CommitLimit is the memory that can be allocated by application.</span></div><div><span style="font-size: small; line-height: 19.5px; background-color: transparent;">2.ioctl_sg01 in serveral machines with your patch,the result is passed.</span></div><div><span style="font-size: small; line-height: 19.5px; background-color: transparent;"><br></span></div><div><span style="font-size: small; line-height: 19.5px; background-color: transparent;">Thanks!</span></div><div><span style="color: rgb(0, 0, 0); background-color: rgba(0, 0, 0, 0);"> </span></div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm"><div style="PADDING-RIGHT: 8px; PADDING-LEFT: 8px; FONT-SIZE: 12px;FONT-FAMILY:tahoma;COLOR:#000000; BACKGROUND: #efefef; PADDING-BOTTOM: 8px; PADDING-TOP: 8px"><div><b>From:</b> <a href="mailto:liwang@redhat.com">Li Wang</a></div><div><b>Date:</b> 2021-03-05 17:02</div><div><b>To:</b> <a href="mailto:liuxp11@chinatelecom.cn">liuxp11@chinatelecom.cn</a></div><div><b>CC:</b> <a href="mailto:chrubis@suse.cz">Cyril Hrubis</a>; <a href="mailto:ltp@lists.linux.it">ltp</a>; <a href="mailto:mdoucha@suse.cz">mdoucha</a></div><div><b>Subject:</b> Re: Re: [LTP] [PATCH 1/2] syscalls/ioctl: ioctl_sg01.c: ioctl_sg01 invoked oom-killer</div></div></div><div><div class="FoxDiv20210324172018095240"><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>
</div></div></blockquote>
</body></html>