From patchwork Tue Nov 17 16:33:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 11912857 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 607F9C5519F for ; Tue, 17 Nov 2020 16:33:56 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 05976216C4 for ; Tue, 17 Nov 2020 16:33:55 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QNKFaM+5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 05976216C4 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B6FB26E055; Tue, 17 Nov 2020 16:33:52 +0000 (UTC) Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by gabe.freedesktop.org (Postfix) with ESMTPS id D5E036E03F for ; Tue, 17 Nov 2020 16:33:44 +0000 (UTC) Received: by mail-wr1-x443.google.com with SMTP id k2so23857821wrx.2 for ; Tue, 17 Nov 2020 08:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=5RsanfRMYtRZA34lNmf+rYEAQYFMbVrpX6WJujlT6tI=; b=QNKFaM+5LUQOGP8rG/b6WOyWh/yALFulKhu7QdeT9qRvy3vu0rWkc9yL+OcusfOmO2 WV6HRBSSjOngsEoV6AuBpJ+i7jtl4QcsDsnNknC6rn/VqIwzO5NOYHuG/2grJCXcN7m8 iaHkSZIJLRAmNSVdbKnuh5bx/ogwcO5pUnw5wnZkdvcnajAFRurEkNvW8pTD41c5qv5P CEeNKgeEC5sKWBM3S6YETpgt+EdKZsTqGTTwTdfhyI+bDFRkd/9614T+J2t3dOBMth3m 9ZB/HRSVNzGa0631O43oeX84zhAykfoPUoOR4Uqe5Gk2rpTltbLwRuCxdegyW0JMVB5s RwXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5RsanfRMYtRZA34lNmf+rYEAQYFMbVrpX6WJujlT6tI=; b=b+Lac5UIDUVWdeUSC9DlCUzzMnabFkFKHF2HH64uoVXJidikojnQd5zNc3r+GZJ70Z Y5h4WKumiNEtxE8wMoJteTS51CkGNlq8YQQtJNU/jnVJ3yKesda71J1a647Y5MFBxdzQ ss7Goy9NbaUQKkugiBwM6XfIL5jNVk8w1klMX9TzFjm30DtDyJLcTacjNBVtOPDSAm75 12C1W9xGzn0BfQ+4K6uKNoLNXd/UwrpGeGP7OzmmYXBFSkzV++7dsSvaq0opfU5PgP9A rnDaoGe1a8MJe96nnZsR774CAUK0YGuEuSJ68TvyBrGSTkS1iTxjLmrft8iXfirx6SSk QSig== X-Gm-Message-State: AOAM532abhqBJ572EAoegqVabQer7hT91JFsJgFgRepYRhQsldBz0Tr7 Q79KtVgnvk5EsigWmK9wswMhqZmu39U= X-Google-Smtp-Source: ABdhPJzepOp7tOHOIIAYzanqvCsnXmXLWfk9bPQuwuV7nVK1x6xdUpn21vpmY6f039DQnwjGQ+9lwg== X-Received: by 2002:a17:906:13d2:: with SMTP id g18mr1682881ejc.76.1605630822495; Tue, 17 Nov 2020 08:33:42 -0800 (PST) Received: from abel.fritz.box ([2a02:908:1252:fb60:dd48:f15c:7bed:4c52]) by smtp.gmail.com with ESMTPSA id dn16sm12225351edb.19.2020.11.17.08.33.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Nov 2020 08:33:42 -0800 (PST) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/4] drm/ttm: optimize ttm pool shrinker a bit Date: Tue, 17 Nov 2020 17:33:38 +0100 Message-Id: <20201117163338.1784-4-christian.koenig@amd.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201117163338.1784-1-christian.koenig@amd.com> References: <20201117163338.1784-1-christian.koenig@amd.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 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" Only initialize the DMA coherent pools if they are used. Signed-off-by: Christian König --- drivers/gpu/drm/ttm/ttm_pool.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 5daf812551ee..54253aa09ffb 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -508,10 +508,12 @@ void ttm_pool_init(struct ttm_pool *pool, struct device *dev, pool->use_dma_alloc = use_dma_alloc; pool->use_dma32 = use_dma32; - for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) - for (j = 0; j < MAX_ORDER; ++j) - ttm_pool_type_init(&pool->caching[i].orders[j], - pool, i, j); + if (use_dma_alloc) { + for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) + for (j = 0; j < MAX_ORDER; ++j) + ttm_pool_type_init(&pool->caching[i].orders[j], + pool, i, j); + } } EXPORT_SYMBOL(ttm_pool_init); @@ -527,9 +529,11 @@ void ttm_pool_fini(struct ttm_pool *pool) { unsigned int i, j; - for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) - for (j = 0; j < MAX_ORDER; ++j) - ttm_pool_type_fini(&pool->caching[i].orders[j]); + if (pool->use_dma_alloc) { + for (i = 0; i < TTM_NUM_CACHING_TYPES; ++i) + for (j = 0; j < MAX_ORDER; ++j) + ttm_pool_type_fini(&pool->caching[i].orders[j]); + } } EXPORT_SYMBOL(ttm_pool_fini); @@ -598,6 +602,11 @@ int ttm_pool_debugfs(struct ttm_pool *pool, struct seq_file *m) { unsigned int i; + if (!pool->use_dma_alloc) { + seq_puts(m, "unused\n"); + return 0; + } + ttm_pool_debugfs_header(m); spin_lock(&shrinker_lock);