summaryrefslogtreecommitdiffstats
path: root/sys/dev/virtio/balloon
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2013-08-10 17:36:42 +0000
committerkib <kib@FreeBSD.org>2013-08-10 17:36:42 +0000
commit4675fcfce0ca7178b334ea67fe2d3ab745477a95 (patch)
tree2ae4177fdf8f77bdbf75571d149fb9e54db96bda /sys/dev/virtio/balloon
parent29e6d17ad1d88a5156b4c44ff927a4ae7be2c279 (diff)
downloadFreeBSD-src-4675fcfce0ca7178b334ea67fe2d3ab745477a95.zip
FreeBSD-src-4675fcfce0ca7178b334ea67fe2d3ab745477a95.tar.gz
Different consumers of the struct vm_page abuse pageq member to keep
additional information, when the page is guaranteed to not belong to a paging queue. Usually, this results in a lot of type casts which make reasoning about the code correctness harder. Sometimes m->object is used instead of pageq, which could cause real and confusing bugs if non-NULL m->object is leaked. See r141955 and r253140 for examples. Change the pageq member into a union containing explicitly-typed members. Use them instead of type-punning or abusing m->object in x86 pmaps, uma and vm_page_alloc_contig(). Requested and reviewed by: alc Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/virtio/balloon')
-rw-r--r--sys/dev/virtio/balloon/virtio_balloon.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/virtio/balloon/virtio_balloon.c b/sys/dev/virtio/balloon/virtio_balloon.c
index 9a87cf2..a90a653 100644
--- a/sys/dev/virtio/balloon/virtio_balloon.c
+++ b/sys/dev/virtio/balloon/virtio_balloon.c
@@ -334,7 +334,7 @@ vtballoon_inflate(struct vtballoon_softc *sc, int npages)
KASSERT(m->queue == PQ_NONE,
("%s: allocated page %p on queue", __func__, m));
- TAILQ_INSERT_TAIL(&sc->vtballoon_pages, m, pageq);
+ TAILQ_INSERT_TAIL(&sc->vtballoon_pages, m, plinks.q);
}
if (i > 0)
@@ -362,8 +362,8 @@ vtballoon_deflate(struct vtballoon_softc *sc, int npages)
sc->vtballoon_page_frames[i] =
VM_PAGE_TO_PHYS(m) >> VIRTIO_BALLOON_PFN_SHIFT;
- TAILQ_REMOVE(&sc->vtballoon_pages, m, pageq);
- TAILQ_INSERT_TAIL(&free_pages, m, pageq);
+ TAILQ_REMOVE(&sc->vtballoon_pages, m, plinks.q);
+ TAILQ_INSERT_TAIL(&free_pages, m, plinks.q);
}
if (i > 0) {
@@ -371,7 +371,7 @@ vtballoon_deflate(struct vtballoon_softc *sc, int npages)
vtballoon_send_page_frames(sc, vq, i);
while ((m = TAILQ_FIRST(&free_pages)) != NULL) {
- TAILQ_REMOVE(&free_pages, m, pageq);
+ TAILQ_REMOVE(&free_pages, m, plinks.q);
vtballoon_free_page(sc, m);
}
}
OpenPOWER on IntegriCloud