Linus Torvalds writes: (Summary) wrote:
Note that that isn't actually all that much of an advantage - it turns out that a lot of users have "range_start", but not "range_end". So in a lot of cases, the "range_start/end()" seems to be exactly as expensive as just the single "page()" call, simply because the code didn't really need the whole range, it only wanted to make sure it was invalidating its data before the range got modified. KVM ends up doing a partial case of that optimization too: it doesn't do the srcu lock in the end case, for example. It does want to keep the sequence numbers for the end case, but that's fairly cheap.
[...]
secondary MMU KVM srcu and spinlock a single time.Note that that isn't actually all that much of an advantage - it turns out that a lot of users have "range_start", but not "range_end". So in a lot of cases, the "range_start/end()" seems to be exactly as expensive as just the single "page()" call, simply because the code didn't really need the whole range, it only wanted to make sure it was invalidating its data before the range got modified. KVM ends up doing a partial case of that optimization too: it doesn't do the srcu lock in the end case, for example. It does want to keep the sequence numbers for the end case, but that's fairly cheap.