Re: [PATCH] virtio_balloon: high order allocation

From: Soichiro Ueda
Date: Thu Dec 29 2022 - 01:27:30 EST


Hi, Shixin.

Thanks for checking the patch!

+ for (i = 0; i < num_pfns; i++) {
+ set_page_pfns(vb, vb->pfns + vb->num_pfns + i,
+ nth_page(page, i));
+ }
Since the interval of vb->num_pfns is VIRTIO_BALLOON_PAGES_PER_PAGE,
it seems that the pfns[] should be vb->pfns + vb->num_pfns + i * VIRTIO_BALLOON_PAGES_PER_PAGE.
Definitely.
+ vb->num_pages +=
+ num_pfns * VIRTIO_BALLOON_PAGES_PER_PAGE;
+ if (!virtio_has_feature(
+ vb->vdev, VIRTIO_BALLOON_F_DEFLATE_ON_OOM))
+ adjust_managed_page_count(page, -num_pfns);
num_pfns is of the unsigned int type so need be to converted to long manually.

Oh, the second argument of adjust_managed_page_count is long type. So it needs casting as you say.

I'll fix these problems in the v2 patch.

Thank you,