From patchwork Wed Aug 13 03:52:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jerome Glisse X-Patchwork-Id: 4715921 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7DE2E9F7CB for ; Wed, 13 Aug 2014 03:52:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B58A0201D3 for ; Wed, 13 Aug 2014 03:52:11 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id AFF4F201C7 for ; Wed, 13 Aug 2014 03:52:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E92D96E514; Tue, 12 Aug 2014 20:52:09 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qg0-f54.google.com (mail-qg0-f54.google.com [209.85.192.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 57B166E519 for ; Tue, 12 Aug 2014 20:52:06 -0700 (PDT) Received: by mail-qg0-f54.google.com with SMTP id z60so10325735qgd.41 for ; Tue, 12 Aug 2014 20:52:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=cExgsmy0/pu1us4JaCFMjwTKVID1ebOGz7hqGe0cF6o=; b=09G4nxCPia0H+f/wMPZENZ7ikzeFC3jknq7BOpBzNX5yGyfliVEOJ2a8M8Fune9cbm Pyjg4/ZJ3I78iHr7Qu5YhYrNFSDFD8Dr4Tdqk+CqJq6ZXUbn/ruPWH9lC2ohfWj9+L6S nLUG8sT/XnJ2fFJaxMTJB1gdvqaZUfSl0OvgKtTnKolzrFmmo6+HRcLtNxLRxt0+ph4k 5XdU62pclVk/dciowH2uNclw03RkzHr6AfywwXeLRI0OAZAmBPsyvhH8485cKnAxcxCy W0Xrvk3J/Nz8HkBopIdU1ydTP+CKNby976g4RJj81jrFTwDqHXttrYRVlfOBsI0kXh2I TRlA== X-Received: by 10.224.88.198 with SMTP id b6mr2451687qam.97.1407901925868; Tue, 12 Aug 2014 20:52:05 -0700 (PDT) Received: from unused-10-19-63-219.boston.devel.redhat.com (c-66-31-44-77.hsd1.ma.comcast.net. [66.31.44.77]) by mx.google.com with ESMTPSA id b5sm1320673qag.17.2014.08.12.20.52.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Aug 2014 20:52:05 -0700 (PDT) From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm/ttm: fix object deallocation to properly fill in the page pool. Date: Tue, 12 Aug 2014 23:52:05 -0400 Message-Id: <1407901926-24516-3-git-send-email-j.glisse@gmail.com> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1407901926-24516-1-git-send-email-j.glisse@gmail.com> References: <1407901926-24516-1-git-send-email-j.glisse@gmail.com> MIME-Version: 1.0 Cc: =?UTF-8?q?J=C3=A9r=C3=B4me=20Glisse?= , Thomas Hellstrom , Konrad Rzeszutek Wilk X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Jérôme Glisse Current code never allowed the page pool to actualy fill in anyway. This fix it and also allow it to grow over its limit until it grow beyond the batch size for allocation and deallocation. Signed-off-by: Jérôme Glisse Reviewed-by: Mario Kleiner Tested-by: Michel Dänzer Cc: Thomas Hellstrom Cc: Konrad Rzeszutek Wilk Reviewed-by: Konrad Rzeszutek Wilk --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c index c96db43..a076ff3 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -953,14 +953,9 @@ void ttm_dma_unpopulate(struct ttm_dma_tt *ttm_dma, struct device *dev) } else { pool->npages_free += count; list_splice(&ttm_dma->pages_list, &pool->free_list); - npages = count; - if (pool->npages_free > _manager->options.max_size) { + if (pool->npages_free >= (_manager->options.max_size + + NUM_PAGES_TO_ALLOC)) npages = pool->npages_free - _manager->options.max_size; - /* free at least NUM_PAGES_TO_ALLOC number of pages - * to reduce calls to set_memory_wb */ - if (npages < NUM_PAGES_TO_ALLOC) - npages = NUM_PAGES_TO_ALLOC; - } } spin_unlock_irqrestore(&pool->lock, irq_flags);