Create a new function kvm_is_visible_memslot() and use it from kvm_is_visible_gfn(); use the new function in try_async_pf() too, to avoid an extra memslot lookup. Opportunistically squish a multi-line comment into a single-line comment. Note, the end result, KVM_PFN_NOSLOT, is unchanged.
Showing the changes to include/linux (1 of 3 files). Show all
Unified · Split
| @@ -1357,6 +1357,12 @@ static inline void kvm_vcpu_set_dy_eligible(struct kvm_vcpu *vcpu, bool val) · 1356 unmodified lines | |||
| 1357 | } | 1357 | } |
| 1358 | #endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */ | 1358 | #endif /* CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT */ |
| 1359 | 1359 | ||
| 1360 | static inline bool kvm_is_visible_memslot(struct kvm_memory_slot *memslot) | ||
| 1361 | { | ||
| 1362 | return (memslot && memslot->id < KVM_USER_MEM_SLOTS && | ||
| 1363 | !(memslot->flags & KVM_MEMSLOT_INVALID)); | ||
| 1364 | } | ||
| 1365 | |||
| 1360 | struct kvm_vcpu *kvm_get_running_vcpu(void); | 1366 | struct kvm_vcpu *kvm_get_running_vcpu(void); |
| 1361 | struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void); | 1367 | struct kvm_vcpu * __percpu *kvm_get_running_vcpus(void); |
| 1362 | 1368 | ||