From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joerg Roedel Subject: Re: [PATCH] intel-iommu: Fix leaks in pagetable freeing Date: Wed, 14 Aug 2013 22:23:51 +0200 Message-ID: <20130814202350.GA3493@8bytes.org> References: <20130615161614.2107.41044.stgit@bling.home> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20130615161614.2107.41044.stgit-xdHQ/5r00wBBDLzU/O5InQ@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Alex Williamson Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: iommu@lists.linux-foundation.org On Sat, Jun 15, 2013 at 10:27:19AM -0600, Alex Williamson wrote: > At best the current code only seems to free the leaf pagetables and > the root. If you're unlucky enough to have a large gap (like any > QEMU guest with more than 3G of memory), only the first chunk of leaf > pagetables are freed (plus the root). This is a massive memory leak. > This patch re-writes the pagetable freeing function to use a > recursive algorithm and manages to not only free all the pagetables, > but does it without any apparent performance loss versus the current > broken version. > > Signed-off-by: Alex Williamson > Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Applied to iommu/fixes, thanks Alex. Will send this for v3.11 after a couple of days in next. From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933135Ab3HNUX4 (ORCPT ); Wed, 14 Aug 2013 16:23:56 -0400 Received: from 8bytes.org ([85.214.48.195]:51423 "EHLO mail.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933031Ab3HNUXz (ORCPT ); Wed, 14 Aug 2013 16:23:55 -0400 Date: Wed, 14 Aug 2013 22:23:51 +0200 From: Joerg Roedel To: Alex Williamson Cc: dwmw2@infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH] intel-iommu: Fix leaks in pagetable freeing Message-ID: <20130814202350.GA3493@8bytes.org> References: <20130615161614.2107.41044.stgit@bling.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130615161614.2107.41044.stgit@bling.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-DSPAM-Result: Whitelisted X-DSPAM-Processed: Wed Aug 14 22:23:54 2013 X-DSPAM-Confidence: 0.9983 X-DSPAM-Probability: 0.0000 X-DSPAM-Signature: 520be75a20861400791629 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jun 15, 2013 at 10:27:19AM -0600, Alex Williamson wrote: > At best the current code only seems to free the leaf pagetables and > the root. If you're unlucky enough to have a large gap (like any > QEMU guest with more than 3G of memory), only the first chunk of leaf > pagetables are freed (plus the root). This is a massive memory leak. > This patch re-writes the pagetable freeing function to use a > recursive algorithm and manages to not only free all the pagetables, > but does it without any apparent performance loss versus the current > broken version. > > Signed-off-by: Alex Williamson > Cc: stable@vger.kernel.org Applied to iommu/fixes, thanks Alex. Will send this for v3.11 after a couple of days in next.