Message ID | 1513849373-7970-4-git-send-email-Hongbo.He@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <dri-devel-bounces@lists.freedesktop.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 15C75603B5 for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 21 Dec 2017 09:44:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0C0D29B77 for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 21 Dec 2017 09:44:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E5B5929B7E; Thu, 21 Dec 2017 09:44:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 229FC29B7E for <patchwork-dri-devel@patchwork.kernel.org>; Thu, 21 Dec 2017 09:44:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A29846E5E0; Thu, 21 Dec 2017 09:44:25 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0069.outbound.protection.outlook.com [104.47.33.69]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2936A6E5E0 for <dri-devel@lists.freedesktop.org>; Thu, 21 Dec 2017 09:44:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=wyAmN2xC8grUfdDPzoycN5yqPswihhefpPgnkXZL2sA=; b=gJNx2vuKPbwQmV8bcYfs8kPHHZ5nM5fS0tUjVkgVJcQnLtILBBPoNCJfYShu9mwnhtXCsffDhS1KsiuaFWH+o8oDdxrvgDXIVY4PboL7CviHSR9oKRsZQcLJ47sAq131RVyX9Tz4qmuq1IgEEBM+WSNf2VtAnlLeNrx4IwHZxyE= Received: from BN4PR12CA0006.namprd12.prod.outlook.com (10.164.241.16) by CY4PR12MB1447.namprd12.prod.outlook.com (10.172.71.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.323.15; Thu, 21 Dec 2017 09:44:23 +0000 Received: from BY2NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e4a::200) by BN4PR12CA0006.outlook.office365.com (2603:10b6:403:2::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Thu, 21 Dec 2017 09:44:23 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; lists.freedesktop.org; dkim=none (message not signed) header.d=none;lists.freedesktop.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by BY2NAM03FT011.mail.protection.outlook.com (10.152.84.233) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.302.6 via Frontend Transport; Thu, 21 Dec 2017 09:44:22 +0000 Received: from roger-build-server.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.361.1; Thu, 21 Dec 2017 03:44:21 -0600 From: Roger He <Hongbo.He@amd.com> To: <dri-devel@lists.freedesktop.org> Subject: [PATCH 4/5] drm/ttm: add new function to check if bo is allowable to evict or swapout Date: Thu, 21 Dec 2017 17:42:52 +0800 Message-ID: <1513849373-7970-4-git-send-email-Hongbo.He@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1513849373-7970-1-git-send-email-Hongbo.He@amd.com> References: <1513849373-7970-1-git-send-email-Hongbo.He@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(376002)(346002)(396003)(39860400002)(39380400002)(2980300002)(428003)(199004)(189003)(2351001)(16586007)(68736007)(72206003)(478600001)(4326008)(105586002)(106466001)(305945005)(356003)(316002)(8676002)(81156014)(51416003)(6666003)(7696005)(86362001)(36756003)(48376002)(104016004)(81166006)(53416004)(59450400001)(97736004)(47776003)(53936002)(2906002)(8936002)(50466002)(5660300001)(76176011)(77096006)(6916009)(2950100002)(50226002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1447; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2NAM03FT011; 1:C9PTQXg48zcBOQk6Pxb6B+pKafqLACjHAkRS9DbSiRGxQQnhsYtYkc5yb/49930ZVd6cIzWEBt1KtlzgA8vZRIvq12Yr4yD73oViLaSjTYCvNPZ/g3SiALn3ACXrDKwn X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a123bfbc-e73e-4c4e-3d41-08d548576aa7 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(2017052603307)(7153060); SRVR:CY4PR12MB1447; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1447; 3:I61nIGg98A7k5m7JHqPGPNk568yRMmIxkLbOb8NwG83nySJDSGisVR2rsw9j5DKGtAY2Ad6jhDkK0NqeBRFQTb59g49+/YZEEf3KRo1KpBLBm4ipxhROAEnScJtqgJ0R1VpMBSHnqJ1lYhkMIE8CJ8bq3cbah5XCATbacLE2zwLWbQ3P8Ra9cqrPGgiZMLtxp/C6P/oCTgXMRxSHoW58lGFEzJhXZt5h2xf9RFtln/JatbvQ86/cdJSANTQPxQZLOnympR1kE+ZJ9h7zVViIKGefKx/iA0vCInPlPrfZlv5XztwKyBoQatrrPa/Ador1NRhDX36xN/Lw6H03U0xFM13no8EA2C84vwqu8bsKFQE=; 25:S9NAa8HDIODCbroCdyvPkZgeruKwGNcky9FWsc41LL1ESmneumVZ9o96obLUjhGIxsw31B01iewLfqDBZALyMyxoD0//1ZYsHycyKhiKa/Qv/CYVxmcWj0MaA3jxmHvE3BEbG/HBLuc6axpsMU5kGj5Csjq0yI5HVKkh0eRaaHcQ939ZHP4VUdnNRGKbzPCFuvEwpDqoY7IYfb9pBH5FIFirTOTEsby0n9K1mNcK4F9zse+as+NqypAcQCnVi4z/5nxawutfPcmp9vufJpUr2ZwPGpEJLQ00cK6zJE+cjGGqK+RD4/yRNFeDCMPkGzHMnq4728g9c4e6MYd+jzo3Wg== X-MS-TrafficTypeDiagnostic: CY4PR12MB1447: X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1447; 31:saQ92kIHv1mDFi8XnQoT9oHpBqyVGlxQNF8En4dHCFnxzdCuZjPwBW3psLYznwoTBInzADZZpR2G5rjqJEIasg+1FJoeVVErufhgvVedhw5paY9ufIpVzZmCyVSXgHtJkmlpqo3b5jTSjhA44ol9d+mCnT7RWY7CnhNjbGQ/82R7Je6eF8yBBz1xsXCtw1LZjKT5dJ/re/y5v5cO92PmvTdUFq0zqQraYBFGcBlDDr8=; 20:bmVCYqm0mi7pTgJuhaKZzO2V975SLLU0bfwzDrAHsidOJSnKoAYcP6iLtjSVe3WlNHqCxwfj6KG3Bq0FjkgEITWE74IqC8W+EPuXPk3CVsbnAaMe5Z2avR/c9gdGkR4plO8VvCnTeum3/8Y89K2Syzm6CXlPAlXzLjZpSJyug0UslNmKcKpknBxep/DI+9JjraY8zd8jqO8oKbOfWmN8KPNnapTL9RwlRNb/fRc/RJRHVerH3VszZp+BBRIPhzZtZKoY79lD3+DyvHk5TZgZ1ovUix+pQVqHB9m1g3O2kJyLjFSE6+UaT4+LyOl10WQLC20FpsWlAe9E+NopZyHkZy/3U7375jh8jzvEqmR5nJKKZq/2Oym/sCdIBU/+YANcR/RKUxSmbDm7L679BnedsJsUXEBkGIqnZs4kmE1FxPtXGiFJgd9H9BiSw3jEBjTTbPSYLfLasrPIDxokjdAAubxUwVQa81dNXN89wDA/nHhtIgDtqbit89LXiqj4xzLs X-Microsoft-Antispam-PRVS: <CY4PR12MB144782C75C4AF4AB850CD410FD0D0@CY4PR12MB1447.namprd12.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040470)(2401047)(8121501046)(5005006)(3002001)(93006095)(93003095)(10201501046)(3231023)(6055026)(6041268)(20161123558120)(20161123562045)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011); SRVR:CY4PR12MB1447; BCL:0; PCL:0; RULEID:(100000803101)(100110400095); SRVR:CY4PR12MB1447; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1447; 4:3yny4mwvgUkAd88ys5rOAe/qMDSqukw1juCoLeUSl1+azVi09SmDxDS2Wp0IelWKslfj9Xdo//VYca+lhCXKfQES9lW4FwnFYgHOFAACpunx/K1qS1ld0hyYT9bFb6jh/xy3j48tmLZRbD0rTN07LKt121O+2BTW3gihCgt0dA80RT1LJ/GBxzWiTRpFHvlarB+b6hzMKx4rQxuJXSDHrel/Yrq9uwpwX2sso6NDT+j8aSEThApdyqzlqcyl7YN5wie64fqNX1VjNDneZ/3q3GjvNISfWPwQOfBxslIyncv+B5bQqO9ugoKx75An/Vwl X-Forefront-PRVS: 0528942FD8 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR12MB1447; 23:dx+BpbnF85+xSgj95SWvFrEC+u3Kbeqglhz/WNEgG?= =?us-ascii?Q?hjvCs6fkOSYd5/1Te3X289q5pZO7JulkQ1cVemRCrmn72aqMSD9HPso2w043?= =?us-ascii?Q?wywcrLWbKj6zP1yUJth2ZiT4vYghgM2dBsen3RY297IPHyL17V+GxK44bWMz?= =?us-ascii?Q?vdthImB/4PKQWh8uCmwdEUH6HIYiBE/xUfrLBmA0Bydq5UTaXgnHb5us31uI?= =?us-ascii?Q?q/SqCXvvVEZMgMiVJEl7NJlNqVqVKs9ClhQJaiu01O0Jz8WgfKAeYaSdqn3j?= =?us-ascii?Q?0MioLdDcCENVt+tVdLFi2t02q37YpTpWn+C43kftS/RL7OAuE2Pr2MZnoCkU?= =?us-ascii?Q?niPibFqSvhWZaDQJhE6/zKJrGC/ymKk6wBg7yikGViN4oAx3a4Z6XOW7ksei?= =?us-ascii?Q?ZUqwrXk0FkLJGNsDHwX9sKfCWiiIHBJawC3UOTlhXRz0iyGKbjLzYRI2TAwG?= =?us-ascii?Q?E5LH14ovlfO07r5dLcqcbv9gxCt0j1Z+8cORmNQhNhMJxo12zx4Bg0MB5f3c?= =?us-ascii?Q?YnM/DZPxedC0AQFO0cfnsX7hEvtz1jDSGJsBSCMe254IEWxIM42zepaKCS/v?= =?us-ascii?Q?GCdTvvdngkJvyxMU78chdbjdsi0ed/ynF7X2u+/mDx1Arh7XtrKXcUdyHakt?= =?us-ascii?Q?zqFMD49IX8SzjIm401a4k2fAl4SVrJhXu+L4bnTe8MoCx4v2m+Fs2gMdymM9?= =?us-ascii?Q?j4abkvdua1r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xY81gNVBpAkj08pi3T6ozK372GbZ6ZjXdJ5T/3dZJVA=; 7:67Lxcfb3UofXhyEiOHG14tuULVs+czhlDggzlu8QyQeC7rkoCXpH1FVSgtA/QmWSK7O/FIjolz8nHLyGlXNtZO9TTUnghOqJwURsdeDaG2SeWZ16t5HnNVDYUJ0UlICzu9OrmRrPalfrDb1ePLtfkUdOJx6xRYOLu23zeTV5884rXydHNYhYQyUrUMjg4UOOfhy6RMZLPBXjefJAjWvkxZtASJaHr37oM2CRVWf035PNh4pI0s4bsJ2i42ouaPgH SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1447; 20:I108/nRCPGqN9ViQOS6Xp0NuWOwdiZlRrrG5lDIhyy7fYn7cFOfK1yJjUpYgXExYfPWMP9h4pTj0Cj69rD1ZH9N3EkBMr0s6vFnv3krQjQ/lMMcAjQm4/v2pZGI48myZJ+Q/X4XoTRr/pUXb1f3xnQablKeY09NfbJD2mC6tQ1CqjogOGQw6LZV+DyA8Vje5jMaHCu3QzIoOPwRvAPQmo4sIePsXBaDf600fMit7bGJDcNhBPO0AplCD1sA38FZI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2017 09:44:22.9774 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a123bfbc-e73e-4c4e-3d41-08d548576aa7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV02.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1447 Cc: Roger He <Hongbo.He@amd.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development <dri-devel.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/dri-devel> List-Post: <mailto:dri-devel@lists.freedesktop.org> List-Help: <mailto:dri-devel-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/dri-devel>, <mailto:dri-devel-request@lists.freedesktop.org?subject=subscribe> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" <dri-devel-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c index e7595b4..313925c 100644 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@ -706,6 +706,23 @@ bool ttm_bo_eviction_valuable(struct ttm_buffer_object *bo, } EXPORT_SYMBOL(ttm_bo_eviction_valuable); +static bool ttm_bo_evict_swapout_allowable(struct ttm_buffer_object *bo, + struct ttm_operation_ctx *ctx, bool *locked) +{ + bool ret = false; + + *locked = false; + if (bo->resv == ctx->resv) { + if (ctx->allow_reserved_eviction || !list_empty(&bo->ddestroy)) + ret = true; + } else { + *locked = reservation_object_trylock(bo->resv); + ret = *locked; + } + + return ret; +} + static int ttm_mem_evict_first(struct ttm_bo_device *bdev, uint32_t mem_type, const struct ttm_place *place, @@ -721,21 +738,13 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, spin_lock(&glob->lru_lock); for (i = 0; i < TTM_MAX_BO_PRIORITY; ++i) { list_for_each_entry(bo, &man->lru[i], lru) { - if (bo->resv == ctx->resv) { - if (!ctx->allow_reserved_eviction && - list_empty(&bo->ddestroy)) - continue; - } else { - locked = reservation_object_trylock(bo->resv); - if (!locked) - continue; - } + if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked)) + continue; if (place && !bdev->driver->eviction_valuable(bo, place)) { if (locked) reservation_object_unlock(bo->resv); - locked = false; continue; } break;
extract a function as ttm_bo_evict_swapout_allowable since eviction and swapout can share same logic Change-Id: I80a475a93fceed8d66d74a1832c815a0756341ac Signed-off-by: Roger He <Hongbo.He@amd.com> --- drivers/gpu/drm/ttm/ttm_bo.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-)