]> xenbits.xensource.com Git - xen.git/commit
xen/timers: Fix memory leak with cpu unplug/plug
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 29 Mar 2019 16:17:24 +0000 (16:17 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 8 Apr 2019 10:16:06 +0000 (11:16 +0100)
commit597fbb8be6021440cd53493c14201c32671bade1
tree8ffb47ef3d397142f37f1687c331d836a687614a
parent1c6504163595d45e47a01750318c2b7b50541cbe
xen/timers: Fix memory leak with cpu unplug/plug

timer_softirq_action() realloc's itself a larger timer heap whenever
necessary, which includes bootstrapping from the empty dummy_heap.  Nothing
ever freed this allocation.

CPU plug and unplug has the side effect of zeroing the percpu data area, which
clears ts->heap.  This in turn causes new timers to be put on the list rather
than the heap, and for timer_softirq_action() to bootstrap itself again.

This in practice leaks ts->heap every time a CPU is unplugged and replugged.

Implement free_percpu_timers() which includes freeing ts->heap when
appropriate, and update the notifier callback with the recent cpu parking
logic and free-avoidance across suspend.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/timer.c