| 
    
 [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH] xen: speed up grant-table reclaim
 On 12.06.23 08:27, Juergen Gross wrote: On 10.06.23 17:32, Demi Marie Obenour wrote:When a grant entry is still in use by the remote domain, Linux must put it on a deferred list.This lacks quite some context. The main problem is related to the grant not having been unmapped after the end of a request, but the side granting the access is assuming this should be the case. In general this means that the two sides implementing the protocol don't agree how it should work, or that the protocol itself has a flaw. > Normally, this list is very short, becausethe PV network and block protocols expect the backend to unmap the grant first.Normally the list is just empty. Only in very rare cases like premature PV frontend module unloading it is expected to see cases of deferred grant reclaims.However, Qubes OS's GUI protocol is subject to the constraints of the X Window System, and as such winds up with the frontend unmapping the window first. As a result, the list can grow very large, resulting in a massive memory leak and eventual VM freeze.I do understand that it is difficult to change the protocol and/or behavior after the fact, or that performance considerations are in the way of doing so.To partially solve this problem, make the number of entries that the VM will attempt to free at each iteration tunable. The default is still 10, but it can be overridden at compile-time (via Kconfig), boot-time (via a kernel command-line option), or runtime (via sysfs).Is there really a need to have another Kconfig option for this? AFAICS only QubesOS is affected by the problem you are trying to solve. I don't see why you can't use the command-line option or sysfs node to set the higher reclaim batch size. Two additional remarks: I wouldn't be opposed to raise the default number of reclaims to a higher number, e.g. 100. Another option would be to move the reclaim handling into a workqueue and try to reclaim as many grants as possible in one go with a cond_resched() call every e.g. 100 reclaims. This would remove the need for having a reclaim upper bound. Juergen Attachment:
OpenPGP_0xB0DE9DD628BF132F.asc Attachment:
OpenPGP_signature 
 
  | 
  
![]()  | 
            
         Lists.xenproject.org is hosted with RackSpace, monitoring our  |