Skip to contentSkip to conversation

xen-blkback: fix memory leaks

PATCH In review Matthew Rushton 2 participants 3 messages Feb 7, 2014 – Feb 12, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 2/4 xen-blkback: fix memory leaks

Quoted 16 lines · Roger Pau Monne

I've at least identified two possible memory leaks in blkback, both related to the shutdown path of a VBD:

- blkback doesn't wait for any pending purge work to finish before cleaning the list of free_pages. The purge work will call put_free_pages and thus we might end up with pages being added to the free_pages list after we have emptied it. Fix this by making sure there's no pending purge work before exiting xen_blkif_schedule, and moving the free_page cleanup code to xen_blkif_free.
- blkback doesn't wait for pending requests to end before cleaning persistent grants and the list of free_pages. Again this can add pages to the free_pages list or persistent grants to the persistent_gnts red-black tree. Fixed by moving the persistent grants and free_pages cleanup code to xen_blkif_free.

Quoted 2 lines

Also, add some checks in xen_blkif_free to make sure we are cleaning everything.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Tested-by Reviewed-by on v2 2/4
#1 lore raw
Quoted 17 lines · Matthew Rushton
Quoted 16 lines · Roger Pau Monne

I've at least identified two possible memory leaks in blkback, both related to the shutdown path of a VBD:

- blkback doesn't wait for any pending purge work to finish before cleaning the list of free_pages. The purge work will call put_free_pages and thus we might end up with pages being added to the free_pages list after we have emptied it. Fix this by making sure there's no pending purge work before exiting xen_blkif_schedule, and moving the free_page cleanup code to xen_blkif_free.
- blkback doesn't wait for pending requests to end before cleaning persistent grants and the list of free_pages. Again this can add pages to the free_pages list or persistent grants to the persistent_gnts red-black tree. Fixed by moving the persistent grants and free_pages cleanup code to xen_blkif_free.

Quoted 5 lines
Quoted 2 lines

Also, add some checks in xen_blkif_free to make sure we are cleaning everything.

Christoph

Tested-by Reviewed-by on v2 2/4
#2 lore raw
In reply to Matthew Rushton
Quoted 17 lines · Matthew Rushton
Quoted 16 lines · Roger Pau Monne

I've at least identified two possible memory leaks in blkback, both related to the shutdown path of a VBD:

- blkback doesn't wait for any pending purge work to finish before cleaning the list of free_pages. The purge work will call put_free_pages and thus we might end up with pages being added to the free_pages list after we have emptied it. Fix this by making sure there's no pending purge work before exiting xen_blkif_schedule, and moving the free_page cleanup code to xen_blkif_free.
- blkback doesn't wait for pending requests to end before cleaning persistent grants and the list of free_pages. Again this can add pages to the free_pages list or persistent grants to the persistent_gnts red-black tree. Fixed by moving the persistent grants and free_pages cleanup code to xen_blkif_free.

Quoted 5 lines
Quoted 2 lines

Also, add some checks in xen_blkif_free to make sure we are cleaning everything.

Christoph