From patchwork Thu Jul 26 11:52:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Rui X-Patchwork-Id: 10545661 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 82EA214E0 for ; Thu, 26 Jul 2018 11:53:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B77F25E97 for ; Thu, 26 Jul 2018 11:53:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 58A5D28979; Thu, 26 Jul 2018 11:53:31 +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=-5.2 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 EE8FB25E97 for ; Thu, 26 Jul 2018 11:53:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E2E986E722; Thu, 26 Jul 2018 11:53:29 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM05-BY2-obe.outbound.protection.outlook.com (mail-eopbgr710054.outbound.protection.outlook.com [40.107.71.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id D05666E71E; Thu, 26 Jul 2018 11:53:28 +0000 (UTC) Received: from MWHPR12CA0059.namprd12.prod.outlook.com (2603:10b6:300:103::21) by CY4PR1201MB0232.namprd12.prod.outlook.com (2603:10b6:910:1e::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.973.21; Thu, 26 Jul 2018 11:53:27 +0000 Received: from DM3NAM03FT056.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::201) by MWHPR12CA0059.outlook.office365.com (2603:10b6:300:103::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.995.16 via Frontend Transport; Thu, 26 Jul 2018 11:53:27 +0000 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV02.amd.com (165.204.84.17) by DM3NAM03FT056.mail.protection.outlook.com (10.152.83.158) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.20.995.12 via Frontend Transport; Thu, 26 Jul 2018 11:53:26 +0000 Received: from hr-intel.amd.com (10.34.1.3) by SATLEXCHOV02.amd.com (10.181.40.72) with Microsoft SMTP Server id 14.3.389.1; Thu, 26 Jul 2018 06:53:24 -0500 From: Huang Rui To: , Subject: [PATCH v2 4/4] drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2) Date: Thu, 26 Jul 2018 19:52:13 +0800 Message-ID: <1532605933-26209-5-git-send-email-ray.huang@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1532605933-26209-1-git-send-email-ray.huang@amd.com> References: <1532605933-26209-1-git-send-email-ray.huang@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)(396003)(346002)(376002)(39860400002)(136003)(2980300002)(428003)(199004)(189003)(356003)(7696005)(72206003)(2906002)(104016004)(14444005)(336012)(77096007)(26005)(106466001)(81166006)(186003)(81156014)(478600001)(8676002)(51416003)(76176011)(305945005)(86362001)(68736007)(110136005)(97736004)(48376002)(47776003)(16586007)(50466002)(316002)(4326008)(53416004)(426003)(8936002)(50226002)(105586002)(446003)(476003)(6666003)(5660300001)(486006)(11346002)(126002)(36756003)(2616005)(54906003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR1201MB0232; H:SATLEXCHOV02.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-Microsoft-Exchange-Diagnostics: 1; DM3NAM03FT056; 1:YABKVInKNAcMXL9LQDzEGnMGvH2wJUG8hDFbHESKJtzbruAbKPy3rMHaEIMHBlEDnydBgH7fsGSKD3TNvLZ3+0VyB+QEhJih2uCnyhoqxDyq4csxScOia7XS3lBbDTeg X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b0845e83-ac95-41c7-ca2c-08d5f2ee65c8 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600073)(711020)(2017052603328)(7153060); SRVR:CY4PR1201MB0232; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 3:5m+LR528ClXcH2yREiiQYKJFsLx7Er3ZgHRvS9jAJ3IyVwIOt2zmzuSXJ8QeG7r7wniVer0DrLE2VdqfJNC2TD6oeWt0tJuWKQ7M383xAe7XicnBy3x0Jt1/XUpJkiRgFeW7z51x2GOHQ/g2H2hgPhtZSdjd4RXOhlfIUxKgWsrbLaojzFvnJOj211yoVWWLNVPl6wPq7j0SKFNZd0JXBZqLq+JN3UhZ75E3l6F0ktgxT3+lK4eSoqEghXhuIHuhawmeMmlEcDn6SzYVd6Rd3nXNP8bWFSo/8vVQkXrXmVf+08mtpOdSxswq4Bv7ULW69GmMzoyj7Qj39GXyefWNm8g30qyZZHMcYSIsACNSFQM=; 25:52lKBh8dYfLzJ2nK97ZdTT19XrNhn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VDpzrgsby8lILIK2DF0gzy6myTwgVCYrJwOnp8XOz/i+moK71/2Q7UVwrRrdp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(93006095)(93003095)(3231311)(944501410)(52105095)(3002001)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:CY4PR1201MB0232; BCL:0; PCL:0; RULEID:; SRVR:CY4PR1201MB0232; X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 4:rLp0syOLbCPqeE5SrhV2iGpy26aIEAGa7DUk5g2kweB115T5t784bVhPD9iiPFqH0zj8O9cl0NWJQi75yOe1ITOegHIYKbeUAsLbNc5nH9lxF2eMGME3RFnQq//WvdnGUepNiJJwgRcvlpMupkVzJFiVMek2QdKi3/Xgt5fRDFiaWge8jA64CbHll7jfqM+UyOkTvg6zC21xNG0kmihLRsD7FfSDVPMUysRMTuYeX2S78eMMfE/V8ryCIy8fuSdh/qRo8TlN75RO50ogbQdkD+KUXP/J0IkUv/fvH/8c72vCtQzLLwT+3RdxNI8TLeg3 X-Forefront-PRVS: 07459438AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR1201MB0232; 23:8jD/6un6fKglXFK/zqABBwqTAYH2kp00PXWi6VF?= ZcVf/QpUZd1xUwuFACfQjxgjjfEGw4SrPiUmPFn3vvRcdcAYfd6WWvjxfIuM4eMAn5X8HHbr7AZ67OLfH2fM0OkZt4txUpweTr6ke9eCH/Vj5ANQw8JYkDeDb4QC615GuI/ZKylMIAzANBkqC8IFw8KY5mL6FR2k928TY77BWn/dudIktXkYCPMehRuBMi6Yj6usU+3jvowhlfyRpBO6VUYklicEi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0MLc8JsnyBnG85Vz6S9DhDMwB89NNORHVAFptOoCHaOCj0s6ihRwZ59sxAvrbLGqpyVA9hr+XBQhGO55avVkJdABzWIuPRk SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY4PR1201MB0232; 20:DagHTWOBz8/M4k90fjXasm8OtfXxMtMqm87wLnDgXlOETzLy7FM9/AvFHGbF56oIJjltsYjBczBDLE6Z7iZSmsXJ8+/FvCGWQHT45QjgohxyUnXIouORFozc2LpXFvQSQrqJLSc3WV8SOL/QYcDlNOwSij9QITRTYgCNYSP5/SADhSAtzsXQtAgI4dpHvZl/LCfe4HW/b+fKNexccjgOFTWqhdWzfW45rYUYhW1lF5zEEKO+3DX+8pZH6ybizrVU X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jul 2018 11:53:26.4557 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b0845e83-ac95-41c7-ca2c-08d5f2ee65c8 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: CY4PR1201MB0232 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bas Nieuwenhuizen , Huang Rui , =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Bas Nieuwenhuizen Every set_pages_array_wb call resulted in cross-core interrupts and TLB flushes. Merge more of them for less overhead. This reduces the time needed to free a 1.6 GiB GTT WC buffer as part of Vulkan CTS from ~2 sec to < 0.25 sec. (Allocation still takes more than 2 sec though) (v2): use set_pages_wb instead of set_memory_wb. Signed-off-by: Bas Nieuwenhuizen Signed-off-by: Huang Rui --- drivers/gpu/drm/ttm/ttm_page_alloc_dma.c | 11 ++++------- 1 file changed, 4 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 f31148a..8304917 100644 --- a/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c +++ b/drivers/gpu/drm/ttm/ttm_page_alloc_dma.c @@ -349,17 +349,14 @@ static void ttm_pool_update_free_locked(struct dma_pool *pool, static void ttm_dma_page_put(struct dma_pool *pool, struct dma_page *d_page) { struct page *page = d_page->p; - unsigned i, num_pages; + unsigned num_pages; /* Don't set WB on WB page pool. */ if (!(pool->type & IS_CACHED)) { num_pages = pool->size / PAGE_SIZE; - for (i = 0; i < num_pages; ++i, ++page) { - if (ttm_set_pages_array_wb(&page, 1)) { - pr_err("%s: Failed to set %d pages to wb!\n", - pool->dev_name, 1); - } - } + if (ttm_set_pages_wb(page, num_pages)) + pr_err("%s: Failed to set %d pages to wb!\n", + pool->dev_name, num_pages); } list_del(&d_page->page_list);