* [PATCH v2 1/1] virtio_balloon: pr_dev_info.report initialization cleanup
@ 2025-12-20 0:30 Dongli Zhang
2025-12-21 11:19 ` David Hildenbrand (Red Hat)
0 siblings, 1 reply; 2+ messages in thread
From: Dongli Zhang @ 2025-12-20 0:30 UTC (permalink / raw)
To: virtualization
Cc: david, jasowang, xuanzhuo, eperezma, mhklinux, linux-kernel
The virtio_balloon vb->pr_dev_info is used as argument for
page_reporting_register() only when the VIRTIO_BALLOON_F_REPORTING feature
is available. There is no need to initialize vb->pr_dev_info.report if this
feature is unavailable.
Similarly, the Hyper-V balloon driver sets dm_device.pr_dev_info.report
only when the corresponding feature is present. If
page_reporting_register() fails, it even resets pr_dev_info.report back to
NULL.
No functional change. Only for cleanup.
Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
---
Changed since v1:
- Add commit message to explain why we would want to do that.
drivers/virtio/virtio_balloon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
index 74fe59f5a78c..0c39f2415324 100644
--- a/drivers/virtio/virtio_balloon.c
+++ b/drivers/virtio/virtio_balloon.c
@@ -1034,7 +1034,6 @@ static int virtballoon_probe(struct virtio_device *vdev)
poison_val, &poison_val);
}
- vb->pr_dev_info.report = virtballoon_free_page_report;
if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING)) {
unsigned int capacity;
@@ -1044,6 +1043,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
goto out_unregister_oom;
}
+ vb->pr_dev_info.report = virtballoon_free_page_report;
+
/*
* The default page reporting order is @pageblock_order, which
* corresponds to 512MB in size on ARM64 when 64KB base page
--
2.39.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/1] virtio_balloon: pr_dev_info.report initialization cleanup
2025-12-20 0:30 [PATCH v2 1/1] virtio_balloon: pr_dev_info.report initialization cleanup Dongli Zhang
@ 2025-12-21 11:19 ` David Hildenbrand (Red Hat)
0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand (Red Hat) @ 2025-12-21 11:19 UTC (permalink / raw)
To: Dongli Zhang, virtualization
Cc: jasowang, xuanzhuo, eperezma, mhklinux, linux-kernel
On 12/20/25 01:30, Dongli Zhang wrote:
> The virtio_balloon vb->pr_dev_info is used as argument for
> page_reporting_register() only when the VIRTIO_BALLOON_F_REPORTING feature
> is available. There is no need to initialize vb->pr_dev_info.report if this
> feature is unavailable.
>
> Similarly, the Hyper-V balloon driver sets dm_device.pr_dev_info.report
> only when the corresponding feature is present. If
> page_reporting_register() fails, it even resets pr_dev_info.report back to
> NULL.
>
> No functional change. Only for cleanup.
>
> Signed-off-by: Dongli Zhang <dongli.zhang@oracle.com>
> ---
> Changed since v1:
> - Add commit message to explain why we would want to do that.
>
> drivers/virtio/virtio_balloon.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c
> index 74fe59f5a78c..0c39f2415324 100644
> --- a/drivers/virtio/virtio_balloon.c
> +++ b/drivers/virtio/virtio_balloon.c
> @@ -1034,7 +1034,6 @@ static int virtballoon_probe(struct virtio_device *vdev)
> poison_val, &poison_val);
> }
>
> - vb->pr_dev_info.report = virtballoon_free_page_report;
> if (virtio_has_feature(vb->vdev, VIRTIO_BALLOON_F_REPORTING)) {
> unsigned int capacity;
>
> @@ -1044,6 +1043,8 @@ static int virtballoon_probe(struct virtio_device *vdev)
> goto out_unregister_oom;
> }
>
> + vb->pr_dev_info.report = virtballoon_free_page_report;
> +
> /*
> * The default page reporting order is @pageblock_order, which
> * corresponds to 512MB in size on ARM64 when 64KB base page
Acked-by: David Hildenbrand (Red Hat) <david@kernel.org>
--
Cheers
David
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-12-21 11:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-20 0:30 [PATCH v2 1/1] virtio_balloon: pr_dev_info.report initialization cleanup Dongli Zhang
2025-12-21 11:19 ` David Hildenbrand (Red Hat)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox