Hi,
On 3/20/19 7:37 PM, Volodymyr Babchuk wrote:
Julien Grall writes:
Anyway, you should explain how you decide the placement of each hypercall_preempt_check(). For instance, if the lists are quite big, then you may want add a preempt check in the loop.
I see your point there. Check in the loop would require additional logic. Is there any best practices? E.g. how often I should check for preemption? Every N iterations of loop, where N is...
It depends on how complex are each iteration of the loop. For instance, in the p2m code, we check preemption every 512 mappings freed (see relinquish_p2m_mapping).
The key point here is to document the choice even if you wrote it is "random". This will help in the future if we need to revise preemption choice.
I'd prefer to do proper fix, if it does not require a big amount of work. Otherwise I'll add document the current state.
proper fix and preemption cannot be in the same sentence :). This is a judgment call based on the complexity of the code.
In the example I gave above, we decided arbitrarily to preempt every 512 iterations. We didn't have any number but though 512 iterations was a good number.
I don't expect you to find the best place right now. I am only asking to document just we know the choice was "arbitrary".
Cheers,