[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen staging] xen/timers: Fix memory leak with cpu unplug/plug (take 2)
commit e978e9ed9e1ff0dc326e72708ed03cac2ba41db8 Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> AuthorDate: Tue Apr 23 16:18:29 2019 +0100 Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> CommitDate: Mon May 13 10:35:37 2019 +0100 xen/timers: Fix memory leak with cpu unplug/plug (take 2) Previous attempts to fix this leak didn't identify the root cause, and ultimately failed. The cause is actually the CPU_UP_PREPARE case (re)initialising ts->heap back to dummy_heap, which leaks the previous allocation. Rearrange the logic to only initialise ts once. This also avoids the redundant (but benign, due to ts->inactive always being empty) initialising of the other ts fields. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/common/timer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/xen/common/timer.c b/xen/common/timer.c index 9ee500b3a7..c85273bf82 100644 --- a/xen/common/timer.c +++ b/xen/common/timer.c @@ -638,9 +638,13 @@ static int cpu_callback( switch ( action ) { case CPU_UP_PREPARE: - INIT_LIST_HEAD(&ts->inactive); - spin_lock_init(&ts->lock); - ts->heap = dummy_heap; + /* Only initialise ts once. */ + if ( !ts->heap ) + { + INIT_LIST_HEAD(&ts->inactive); + spin_lock_init(&ts->lock); + ts->heap = dummy_heap; + } break; case CPU_UP_CANCELED: -- generated by git-patchbot for /home/xen/git/xen.git#staging _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |