<div>
                    <br>
                </div>
                <div><div><br></div><div>-- </div><div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Best regards </div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">Eli</div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><br></div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);">天涯无处不重逢</div><div style="color: rgb(34, 34, 34); font-family: arial, sans-serif; font-size: 14px; font-variant-ligatures: normal; orphans: 2; widows: 2; background-color: rgb(255, 255, 255);"><span style="color: rgb(0, 0, 0); font-family: "Microsoft YaHei", Verdana, arial, sans-serif;">a leaf duckweed belongs to the sea, where not to meet in life </span></div></div><div>Sent with <a href="http://www.sparrowmailapp.com/?sig">Sparrow</a></div><div><br></div></div>
                  
                <p style="color: #A0A0A8;">On Tuesday, 21 February 2017 at 4:54 AM, Marcelo Tosatti wrote:</p><blockquote type="cite"><div>
                    <span><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Can you explain how the resource leak can happen?</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br></div></span></div></blockquote><div>1. libvirtd creates a qemu process and create a resctrl directory for it, add it’s pids to tasks</div><div>2. stop libvirtd or it’s down.</div><div>3. qemu process, and tasks file is empty now.</div><div>4. libvirt restart, well, the resctrl directory should be deleted as qemu process gone.</div><blockquote type="cite"><div><span><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Why it is not possible to maintain that information inside libvirt</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">itself?</div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br></div></span></div><div><span><blockquote type="cite" style="border-left-style: solid; border-left-color: rgb(0, 33, 98); border-width: 1px; color: rgb(0, 33, 98); margin-left: 0px; padding-left: 10px; padding-right: 0px; margin-right: 0px; font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: block;"><div><blockquote type="cite" style="border-left-style: solid; border-left-color: rgb(0, 33, 98); border-width: 1px; color: rgb(0, 33, 98); margin-left: 0px; padding-left: 10px; padding-right: 0px; margin-right: 0px;"><div><div>This is not for cleanup purposes, since on VM shutdown the resctrlfs<span> </span></div><div>directories are properly removed:</div><div>/* Remove the Domain from sysfs, this should only success no pids in</div><div>* tasks</div><div>* of a partition.</div><div>*/</div><div>static</div><div>int virResCtrlRemoveDomain(const char *name)</div><div>{</div><div>char *path = NULL;</div><div>int rc = 0;</div><div>if ((rc = virAsprintf(&path, "%s/%s", RESCTRL_DIR, name)) < 0)</div><div>return rc;</div><div>rc = rmdir(path);</div><div>VIR_FREE(path);</div><div>return rc;</div><div>}</div><div>Should not write to other directories 'tasks' file.</div></div></blockquote><div><br></div><div>Other Apps can have a lock to resctrl before it write tasks to prevent libvirtd remove empty task directory.</div></div></blockquote><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><br></div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Well then libvirt will never be able to change resctrl filesystem?</div></span>
                  
                  
                  
                  
                </div></blockquote><div>
                    no, Apps only grant lock when it creates new cache allocation, should release the lock after adding the app’s pid to tasks.
                </div>