[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] xl: relax freemem()'s retry calculation


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Tue, 12 Jul 2022 13:55:02 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 12 Jul 2022 12:55:24 +0000
  • Ironport-data: A9a23:6lb21aqhqANQTdUcKC6KMdhXx1heBmJJZRIvgKrLsJaIsI4StFCzt garIBmFPv3fYDPye9pxbIi+8U5T75CAyt9kGgI9pSAwQ3hDoJuZCYyVIHmrMnLJJKUvbq7GA +byyDXkBJppJpMJjk71atANlVEliefQAOCU5NfsYkidfyc9IMsaoU8lyrRRbrJA24DjWVvS4 Imq+qUzBXf+s9JKGjNMg068gEsHUMTa4Fv0aXRnOJinFHeH/5UkJMp3yZOZdhMUcaENdgKOf M7RzanRw4/s10xF5uVJMFrMWhZirrb6ZWBig5fNMkSoqkAqSicais7XOBeAAKv+Zvrgc91Zk b1wWZKMpQgBZbTVuOkYd15jISwvIIQX17D+cSekiJnGp6HGWyOEL/RGCUg3OcsT+/ptAHEI/ vsdQNwPRknd3aTsmuv9E7QywJR4RCXoFNp3VnVIxDfFDfEgUNbbTr/D/9Nw1zYsnMFeW/3ZY qL1bBIwMUmRM0ceaz/7DroPutmTukncIgRaqWzWq5Rs8zOU7ydYhe2F3N39JYXRGJQ9clyjj n3C13T0BFcdLtP34SqI9Degi/HCmQv/WZkOD/uo+/hymlqRy2cPThoMWjOTo/O0l0q/UNJ3M FEP92wlqq1ayaCwZoCjBVvi+ifC50NCHYoLewEn1O2T4vHN+iaUA0xDdQxMOcEP5eA5fGx1z WbcyrsFGgdTXK2ppWO1r+nJ8m7jYXVMdQfudgdfE1JbvoCLTJUby0uWE409SPPdYsjdQ2mY/ tyckMQpa1z/Z+Yv3r7zw13IiinESnPhHl9svVW/so5IA2pEiG+Zi2+AswGzAQ5odtrxc7V4l CFsdzKixO4PF4qRsyeGXf8AGrqkj97cbmCD3AAzQcF7qWT0k5JGQWy3yGgkTHqFz+5eIWO5C KMtkVk5CGBv0IuCMvYsPtPZ5zUCxqn8D9X1Ps3pgi51SsEpLmevpXg2DWbJhjyFuBV9yskXZ MbEGftA+F5HUMyLOhLtH7dDuVLqrwhjrV7uqWfTkkz5jOPOOSXOIVrHWXPXBt0EAGq/iF292 75i2wGikX2zjMWWjvHrzLMu
  • Ironport-hdrordr: A9a23:72e/4KER8mpSrgrppLqE6MeALOsnbusQ8zAXP0AYc3Jom+ij5q STdZUgpHrJYVkqNU3I9ertBEDEewK6yXcX2/hyAV7BZmnbUQKTRekIh7cKgQeQeBEWntQts5 uIGJIeNDSfNzdHsfo=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Tue, Jul 12, 2022 at 09:01:48AM +0200, Jan Beulich wrote:
> On 11.07.2022 18:21, Anthony PERARD wrote:
> > On Fri, Jul 08, 2022 at 03:39:38PM +0200, Jan Beulich wrote:
> >> While in principle possible also under other conditions as long as other
> >> parallel operations potentially consuming memory aren't "locked out", in
> >> particular with IOMMU large page mappings used in Dom0 (for PV when in
> >> strict mode; for PVH when not sharing page tables with HAP) ballooning
> >> out of individual pages can actually lead to less free memory available
> >> afterwards. This is because to split a large page, one or more page
> >> table pages are necessary (one per level that is split).
> >>
> >> When rebooting a guest I've observed freemem() to fail: A single page
> >> was required to be ballooned out (presumably because of heap
> >> fragmentation in the hypervisor). This ballooning out of a single page
> >> of course went fast, but freemem() then found that it would require to
> >> balloon out another page. This repeating just another time leads to the
> >> function to signal failure to the caller - without having come anywhere
> >> near the designated 30s that the whole process is allowed to not make
> >> any progress at all.
> >>
> >> Convert from a simple retry count to actually calculating elapsed time,
> >> subtracting from an initial credit of 30s. Don't go as far as limiting
> >> the "wait_secs" value passed to libxl_wait_for_memory_target(), though.
> >> While this leads to the overall process now possibly taking longer (if
> >> the previous iteration ended very close to the intended 30s), this
> >> compensates to some degree for the value passed really meaning "allowed
> >> to run for this long without making progress".
> >>
> >> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> >> ---
> >> I further wonder whether the "credit expired" loop exit wouldn't better
> >> be moved to the middle of the loop, immediately after "return true".
> >> That way having reached the goal on the last iteration would be reported
> >> as success to the caller, rather than as "timed out".
> > 
> > That would sound like a good improvement to the patch.
> 
> Oh. I would have made it a separate one, if deemed sensible. Order
> shouldn't matter as I'd consider both backporting candidates.

OK.

For this patch:
Reviewed-by: Anthony PERARD <anthony.perard@xxxxxxxxxx>

Thanks,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.