diff mbox series

KVM: get rid of var page in kvm_set_pfn_dirty()

Message ID 1575515105-19426-1-git-send-email-linmiaohe@huawei.com (mailing list archive)
State New, archived
Headers show
Series KVM: get rid of var page in kvm_set_pfn_dirty() | expand

Commit Message

Miaohe Lin Dec. 5, 2019, 3:05 a.m. UTC
From: Miaohe Lin <linmiaohe@huawei.com>

We can get rid of unnecessary var page in
kvm_set_pfn_dirty() , thus make code style
similar with kvm_set_pfn_accessed().
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 virt/kvm/kvm_main.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

Comments

Paolo Bonzini Dec. 5, 2019, 10:18 a.m. UTC | #1
On 05/12/19 04:05, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> We can get rid of unnecessary var page in
> kvm_set_pfn_dirty() , thus make code style
> similar with kvm_set_pfn_accessed().
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  virt/kvm/kvm_main.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
> index 00268290dcbd..3aa21bec028d 100644
> --- a/virt/kvm/kvm_main.c
> +++ b/virt/kvm/kvm_main.c
> @@ -1931,11 +1931,8 @@ EXPORT_SYMBOL_GPL(kvm_release_pfn_dirty);
>  
>  void kvm_set_pfn_dirty(kvm_pfn_t pfn)
>  {
> -	if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn)) {
> -		struct page *page = pfn_to_page(pfn);
> -
> -		SetPageDirty(page);
> -	}
> +	if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn))
> +		SetPageDirty(pfn_to_page(pfn));
>  }
>  EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty);
>  
> 

Queued, thanks.

Paolo
Sean Christopherson Dec. 6, 2019, 9:38 p.m. UTC | #2
On Thu, Dec 05, 2019 at 11:05:05AM +0800, linmiaohe wrote:
> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> We can get rid of unnecessary var page in
> kvm_set_pfn_dirty() , thus make code style
> similar with kvm_set_pfn_accessed().

For future reference, there's no need to wrap so aggressively, preferred
kernel style is to wrap at 75 columns (though for some reason I am in the
habit of wrapping changelogs at 73 columns), e.g.:

We can get rid of unnecessary var page in kvm_set_pfn_dirty(), thus make
code style similar with kvm_set_pfn_accessed().
diff mbox series

Patch

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 00268290dcbd..3aa21bec028d 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1931,11 +1931,8 @@  EXPORT_SYMBOL_GPL(kvm_release_pfn_dirty);
 
 void kvm_set_pfn_dirty(kvm_pfn_t pfn)
 {
-	if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn)) {
-		struct page *page = pfn_to_page(pfn);
-
-		SetPageDirty(page);
-	}
+	if (!kvm_is_reserved_pfn(pfn) && !kvm_is_zone_device_pfn(pfn))
+		SetPageDirty(pfn_to_page(pfn));
 }
 EXPORT_SYMBOL_GPL(kvm_set_pfn_dirty);