From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steve Kemp Subject: Re: How to diagnose memory leak in kvm-qemu-0.14.0? Date: Fri, 20 May 2011 12:47:07 +0100 Message-ID: <20110520114707.GG27422@bytemark.co.uk> References: <20110518164429.GA20927@bytemark.co.uk> <20110519115734.GB3490@bytemark.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: Stefan Hajnoczi Return-path: Received: from egg.sh.bytemark.co.uk ([212.110.161.171]:37983 "EHLO egg.sh.bytemark.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935412Ab1ETLrJ (ORCPT ); Fri, 20 May 2011 07:47:09 -0400 Content-Disposition: inline In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Fri May 20, 2011 at 12:01:58 +0100, Stefan Hajnoczi wrote: > > =A0wget http://mirror.bytemark.co.uk/misc/test-files/500M > > =A0while true; do cp 500M foo.img; rm foo.img; sleep 2; done > > > > =A0"top" shows the virt memory growing to >1gb in under two minutes= =2E > > Were you able to track down the culprit? Yes, or at least confirm my suspicion. The virtio block device is the source of the leak. Host kernel: 2.6.32.15 Guest Kernel: linux-2.6.32.23 Leaking case: opt/kvm2/bin/qemu-system-x86_64 -m 500 \ -drive file=3D/machines/kvm2/jail/root_fs,if=3Dvirtio,cache=3Doff Non leaking case: /opt/kvm/current/bin/qemu-system-x86_64 -m 500 \ -drive file=3D/machines/kvm1/jail/root_fs,cache=3Doff .. The leak occurs with both KVM 0.12.5 and 0.14.0. I've had a quick read of hw/virtio-blk.c but didn't see anything glaringly obvious. I'll need to trace through the code, drink more coffee, or get lucky to narrow it down further. Steve Kemp -- Bytemark Hosting http://www.bytemark.co.uk/ phone UK: 0845 004 3 004 Dedicated Linux hosts from 15ukp ($30) per month