lkml.org 
[lkml]   [2021]   [Jan]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 04/24] kvm: x86/mmu: change TDP MMU yield function returns to match cond_resched
From
Date
On 20/01/21 19:38, Sean Christopherson wrote:
> Currently the TDP MMU yield / cond_resched functions either return
> nothing or return true if the TLBs were not flushed. These are confusing
> semantics, especially when making control flow decisions in calling
> functions.
>
> To clean things up, change both functions to have the same
> return value semantics as cond_resched: true if the thread yielded,
> false if it did not. If the function yielded in the_flush_ version,
> then the TLBs will have been flushed.

My fault here. The return value was meant to simplify the assignments
below. But it's clearer to return true if the cond_resched happened,
indeed.

>>
>>
>> if (can_yield)
>> - flush_needed = tdp_mmu_iter_flush_cond_resched(kvm, &iter);
>> + flush_needed = !tdp_mmu_iter_flush_cond_resched(kvm,
>> + &iter);
>
> As with the existing code, I'd let this poke out. Alternatively, this could be
> written as:
>
> flush_needed = !can_yield ||
> !tdp_mmu_iter_flush_cond_resched(kvm, &iter);
>

Yeah, no new line here.

Paolo

\
 
 \ /
  Last update: 2021-01-21 21:31    [W:0.156 / U:0.400 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site