Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=198.175.65.21 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1796339497; b=BLnElqivHAOweV9xeZ+h0DKCnF9bi2WkI8YFw5SGPUp/4fdvIeQRnBdRs9GaojuFZu1o RNOis9NuzV9NU6Mt3g4TgXGjkmZ0t1IS3S+4xHB2IzEqjh++X8HyAm7camZD2J9v/lLAh pCc+QUzAv6x/RVc7OL61IjLRUOroBtUaK+2yCrLjQqmTm2TSTjvmRMyKWWg5bM7Gd1uh1 1gEVwGXWeCmeiyYJHBc7k0Y8RuBBt5o7auCtY3eeBn0GXHoSy2Z6c7yJiGLP19ozrPv+t 7Dx8Ln2CcYQeXAbSQfzu9JgQmDR/0G4O8b+IDoqrZuG1EPecSLsyVVTDGlJKJNb/tKw== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796339497; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Received:Received: Received:Received:Received:Date:From:To:CC:Subject:Message-ID: References:Content-Type:Content-Disposition:Content-Transfer-Encoding: In-Reply-To:X-ClientProxiedBy:MIME-Version:X-MS-PublicTrafficType: X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id: X-LD-Processed:X-MS-Exchange-SenderADCheck: X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam: X-Microsoft-Antispam-Message-Info:X-Forefront-Antispam-Report: X-MS-Exchange-AntiSpam-MessageData-ChunkCount: X-MS-Exchange-AntiSpam-MessageData-0:X-Exchange-RoutingPolicyChecked: X-MS-Exchange-CrossTenant-Network-Message-Id: X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs: X-MS-Exchange-CrossTenant-OriginalArrivalTime: X-MS-Exchange-CrossTenant-FromEntityHeader: X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-MailboxType: X-MS-Exchange-CrossTenant-UserPrincipalName: X-MS-Exchange-Transport-CrossTenantHeadersStamped:X-OriginatorOrg; bh=j1w/aZXx92+Ea+6O5vK9bSNtl6rbRm2UTTjJbTVeSxM=; b=4LVOIo6cFtm/s8CNy0XodiEgtR6j2KyEwEz96P3uGdRwb8x3BupWuMQTmgMA5PjnvzV6 +EjJUGRbYjUudFSD4Q823DCqcl6LAsMOSnRC3ojJxftU6buWKtg376V4Sz8ganYhYh8ri jgYldWQo5aCXod+MDehL1CpQrlJL43ej65l4scsmxNELlW1cEKaqu0oUX5WLCm2O3jZ25 LC/Jc59FFQapHYPqPZlBBe/GROMk9NbWEroz/vVHIMXjsk8w2DLa8EBReHhhsrUzVoi/Z LZCUNnVVgl2cXUbbDz4osj//0renJBmWTe9QwSq8e5vJ93L40LJg+wIrOud7ChiuaBA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b="VS2ir/tb"; arc=fail smtp.remote-ip=198.175.65.21 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 47C63606A322 for ; Thu, 3 Dec 2026 23:11:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47C63606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=VS2ir/tb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796339497; x=1827875497; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=j1w/aZXx92+Ea+6O5vK9bSNtl6rbRm2UTTjJbTVeSxM=; b=VS2ir/tbS5AJNRmOJ2GKmRf9CxSq3uS+R3ZKXdWqHoXulqXgv0zAXWKY Lmk4zXbntuZqDMUSQFWQ00LauCUJ77axS64f9ha3DdAGvn9N36H0G4yWV 2Elb1by+kJTzllDWeocijI6UPuFFRrNNhCvQjht6D9TaIVyavXRMep2Ny 6NdXY6Ez5DgVYmBjeKOl/ilQvqAfeh/wqMdKD6XH0kITtAI9zQ0bC3Pg8 WAcsGT16uliZICMps0Wi1O1pF8AUqFZ8Qpf++yExjzxz+iXVIXm3CBDwu AcOfvbbbjr2vYWz/Vrm/aUv4+P4/7eCUBMfCOWdSLXMBGU3iplarn60sr Q==; X-CSE-ConnectionGUID: L2JmmspjRu2PJV3AQer+fw== X-CSE-MsgGUID: 2qIPzoc/TOepY2ZYpVMCLg== X-IronPort-AV: E=McAfee;i="6800,10657,11985"; a="5419295" X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="5419295" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 15:11:34 -0800 X-CSE-ConnectionGUID: 180anRrQSJuasplh17HT9A== X-CSE-MsgGUID: xYuj2jX9RXed5AJDNkYsxA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,77,1794902400"; d="scan'208";a="14305392" Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23]) by orviesa009.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 15:11:34 -0800 Received: from ORSMSX903.amr.corp.intel.com (10.22.229.25) by ORSMSX901.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 15:11:33 -0800 Received: from ORSEDG902.ED.cps.intel.com (10.7.248.12) by ORSMSX903.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Thu, 3 Dec 2026 15:11:33 -0800 Received: from CO1PR03CU002.outbound.protection.outlook.com (52.101.46.13) by edgegateway.intel.com (134.134.137.112) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Thu, 3 Dec 2026 15:11:33 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=YNp9tv81ok8gIHOzhW/+NXfMEttfEtQCK+CHIe/p0QQk7XhXCQu0jiWJPgXRmq1B7nRx4kme8tfgonLB9b/BPXjS/B1GSYLWTwMyP4ifkDtVMMmgGUC8YMrkXhKN7jrhI21f006Z2bvPi3eAA+iFRJPSiE0sLeyu3PbMkU8Hzdk3gcMtW35PGN/gU6xSfl6EkoKSETLSiyA8xuJB8kQHzwyGbU4dopqODr+1WEQI+86KMItJaE6oezUMKEJ/xfdbE2MLnTF6sUox8uYbjpg9faoJ7W1GyZga3nrXgYJesYlac47nBqRggOyR+6aYOoWYO5ylv2tbXM8kB9HKIKIZxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AuhhYi67OS0La92XhIjYNwSfdRzmbq1YX6dqKhAE+QA=; b=rE77I0dzWv55mrs0nV4iXRc3UbAs0TIZZmmYo8LoOfqqq05o6XcKqU0m5/mE3SGSvsT+9IdDMdMtJ3P4WYuYSlLjRDt2ZUrpZkV0otK79G4u12NMvWLmHzlki3zWw9RPbSpHwXNwW2HGa3Re6ybXC2P577zTO8O/birkQUfwmlRpiiA0lxZIWeH83GgN4b5L3/IMvhuV7cXGRUDncr+c8DdeKDGuAKHE+lkR9c4oPj2lMvJVNBN9wASpxM5gfWj9o/0DEIlaSl6DPduhMd8Y3iyOa5Jg7ixEn35t3Ad4q7/oOrkdcxSu2sqaZUWR1eKQaR35P+2o/D5H9RXKZUmJEQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MW3PR11MB4684.namprd11.prod.outlook.com (2603:10b6:303:5d::14) by SN7PR11MB7139.namprd11.prod.outlook.com (2603:10b6:806:2a2::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Thu, 3 Dec 2026 23:11:28 +0000 Received: from MW3PR11MB4684.namprd11.prod.outlook.com ([fe80::2f5a:96ce:f7e4:c315]) by MW3PR11MB4684.namprd11.prod.outlook.com ([fe80::2f5a:96ce:f7e4:c315%7]) with mapi id 15.21.0688.011; Thu, 3 Dec 2026 23:11:28 +0000 Date: Thu, 3 Dec 2026 15:11:25 -0800 From: Niranjana Vishwanathapura To: Matthew Brost CC: , , Carlos Santa , Ryan Neph , Natalie Vock , Arun Pravin , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , , Thomas =?iso-8859-1?Q?Hellstr=F6m?= Subject: Re: [PATCH v6 08/35] drm/ttm: Harvest beneficial-order pages on defragmentation moves Message-ID: References: <20261203202352.4153159-1-matthew.brost@intel.com> <20261203202352.4153159-9-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20261203202352.4153159-9-matthew.brost@intel.com> X-ClientProxiedBy: PH3PEPF0000409B.namprd05.prod.outlook.com (2603:10b6:518:1::47) To MW3PR11MB4684.namprd11.prod.outlook.com (2603:10b6:303:5d::14) X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PR11MB4684:EE_|SN7PR11MB7139:EE_ X-MS-Office365-Filtering-Correlation-Id: 374004a0-449b-4ad6-fbc0-08df5192c29a X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|1800799024|23010399003|366016|261102123227099003|10067099003|261021130227099003|56012099006|261021135927099003|261102130727099003|261022075727099003|261022115727099003|261022105027099003|261021121427099003|261021133027099003|261026130827099003|261026121527099003|261028144727099003|261026140227099003|261026135527099003|261021123027099003|261022113327099003|261009220027099003|261009223327099003|261009223027099003|261009221727099003|261009221227099003|18002099003|22082099003|4143699003|11063799006|6133799003; X-Microsoft-Antispam-Message-Info: cVI1SGXh3uc0a3ds6byfPfFHjDZG+sr98A1JcX6wcBsPFKBu8pzASlR7QkWQrdUcRSoBaUb0uBzgS7Le/XsMztoNmDOhtXp7Y7Y3jYVbG7Neejk0iHKht+QOOQ5H2OnZSTlNt5RpZdl/9TBXzwKS9n17N2vtacVJ4H8aTyMUv5ot2tzxeq7LPZQTw1TP/lHj2l4zeOU9N3DGx2iVmlif6CXg7s46pluw+XMEoYeHm8Uw4SC20qFunoVYo9yZIsrIMkCgHQuOtLY2KO7u04Kr8MhgDKUma60DEK5M4/OrpoWXimJEnIfrveIYoOzzKNE0ab4bSZbofXk1FSbywAyBaSBhRsudXLmeQZsmTShC350Iuu+FL0dCx2urfxfH4P9mFh3W53r8hxgJX7WNtoEHL9bnYO+4LL5EVVCefGaztIrprBWs5b62t1iCy0As61m5RopULHncKrCiGnWXT47yxrwDvspwyoHZ/LBXfvkfEQSjnXcMxbKiRmITqDgDZ3R3fnGldhToHjz1FdcJoKG4LQwOu8MqIl4gjxIXgqBCBh12MzmlW7cZ6zjhQJrb32KFnFZm5n4yohyrnleXFMoOkZgojA4OalQ1RUiaVvoblCoOMP5dcuNqQrZPtD6A7AcejiX8O9ZnxqXVB3q3UDq+AqKujzoKHQoNydnLxLFomb8= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR11MB4684.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(1800799024)(23010399003)(366016)(261102123227099003)(10067099003)(261021130227099003)(56012099006)(261021135927099003)(261102130727099003)(261022075727099003)(261022115727099003)(261022105027099003)(261021121427099003)(261021133027099003)(261026130827099003)(261026121527099003)(261028144727099003)(261026140227099003)(261026135527099003)(261021123027099003)(261022113327099003)(261009220027099003)(261009223327099003)(261009223027099003)(261009221727099003)(261009221227099003)(18002099003)(22082099003)(4143699003)(11063799006)(6133799003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?zqFl3Qz4loGh0cVudEm1EQlXIZSGEWZ8tFufHDz4Q1OG+n0n2My010gIh7?= =?iso-8859-1?Q?Zuj343SfTao50dqkQMmjT0bTheFkJbCtfNGRJInT1KzsoJFq+jMitG7muH?= =?iso-8859-1?Q?i2raKpaGo8MDvPIClkrxiK71lco8Z9zaOeL2EgcjjldIXo8UYbqd851NP7?= =?iso-8859-1?Q?Vl1S4sP6BdF0+CPRXv3+3DeVK1Fpkj3vAQxkKnIBEvp1GviBdnaVDwrxJl?= =?iso-8859-1?Q?UOpdiOhXWQBMLHAbdvrxUitb+X7Hp4jqqqBMRpPbzuon6d47hKM9f1cyCu?= =?iso-8859-1?Q?syJ3in9kIl8VqiS5IwhVGcwIOdG5rGwjuJwBicLGtLoMAfGV/LE5jT/sz+?= =?iso-8859-1?Q?qiTl39KNLFYKNN9g9Mvny1eCCoGcoOiU0Aw0SsRzQgbstgo+B4NND0jQMO?= =?iso-8859-1?Q?YjAeG/8dSTCyiq9vz4S8QAr1uRb7WyFnN/T25h0EUQoYl+Dq+eXIjcKAok?= =?iso-8859-1?Q?g4Fj2a9GWnLUiHBTEzwEA568kkekRiUNqAVTAalQc2FYobnRsVUPh7Twvt?= =?iso-8859-1?Q?MRtrbHD6lkPs32WdNHCtIAjVkOb0ZW3PJhXNutfIhZHH5Q4ibfsgYf9Izq?= =?iso-8859-1?Q?rNKDwN9ZhhdjbPAACMGA8cTUMbPJXoqEm6QBowui6soVqYXdU6wkgrO4Up?= =?iso-8859-1?Q?26SOq/Ke0PK270dvp8PCUolmvDkraH1JD4PaMPmYrpCTjgp4LEHZgVaO93?= =?iso-8859-1?Q?hgSaWRljKOtrxwkFKMvRxiTpANhVY1a/YmFUM5D3FHZ+V0ptJiEchYcP7M?= =?iso-8859-1?Q?uqKeSBMUYd0YHh89mTsFVxVvhAdhX0VclBlAuYHK1LjC2DUZJoNOoQdM3t?= =?iso-8859-1?Q?6MLsfePQ6ofhAjWxS0r8DMBP1qqhI9iEwl0yinx77rWCb8Nsaar7/s7tsj?= =?iso-8859-1?Q?qLn04nNRO16mHmC8RhOUxeZ0VAuTJFcntdsVfSC4ETMKq+Kn13xsPmPf2H?= =?iso-8859-1?Q?7KZHdTfas+rdTfzcoJTtp2q2rmK4qPaNgtoHuUd43+5HyqUyqJc9FuS3+r?= =?iso-8859-1?Q?qjUbBLp64cTYpqRYJwV3iQ65Dz9VdyVVsV61zzhBdVl1BWQ1TKwFjnSCQd?= =?iso-8859-1?Q?++j9wBcvlKkr3kAIhKJHx/dNw46NONYWERTV9YGf9UJ8q4a4OXLYV6WGob?= =?iso-8859-1?Q?vSAaRAcqErSoCO/fT6nFA4iGH4BjbAtXAxCwsDIcEcSumP+7K1l3S4qKpA?= =?iso-8859-1?Q?E8CjVS2zEfpg1/U4tsN6U9iIWCO266QjEXFBaXhKU2a9ph+wrzW4aMPRPf?= =?iso-8859-1?Q?6GHPuT+56MmmhDgxHuqP1HGAhgqCDPyh42JQ8z3Affpe9OJJYwh/hFh4cr?= =?iso-8859-1?Q?4cCsNaOt7IpuKpdnzwjPDmmcfrg7Y8pJd2DzIXU9eOMdFPLHu7fEuuKoGA?= =?iso-8859-1?Q?zMf6tKSx+EGVpW2nD0szs3egJKEA/5qJVCXE6F9eW/p5kBzcHrJvZy629+?= =?iso-8859-1?Q?HtmEs0dOp38g7Jte6HaK2ja2P3lf2jhATRaklNXnGv7v4cSbRHOla9Xmib?= =?iso-8859-1?Q?Y6okmiPvvWX6ajW3SQnIHOXfX3+SkjBHI6GA8gwr91d/soPWKoAXNG2FxM?= =?iso-8859-1?Q?V3yenioUV3xPKF0a2FsfybZAbdE1MM7XCa8kuj4921pfB/JmhhsaAGQOZp?= =?iso-8859-1?Q?kRU7xBDuijncezim0XtRNEmbxWPyEE/Z+PgRNG2d7xATT/qAtLz3FxlSt6?= =?iso-8859-1?Q?XrD+uflGgyk6gXs0gC4GvE+Pg/F11y7tUUWq3LJ4jO/OTM4BhaYkLxV1ao?= =?iso-8859-1?Q?OkOb/DPmxOI2r9xW14ctQCu3Dk4jV2ezEh0kXphaf3cFLr1FGhxwfomdkV?= =?iso-8859-1?Q?uPedInqS3UMUxoN3qeTfymnAuKoqaz5KKHaEqlAXngGO1aPkTtiB?= X-Exchange-RoutingPolicyChecked: SQTyxw4inCNjeaJEGRuB3BKBH1mES5ChrbHs69olymLDcfI1OV6VbbtlH4tsYGXJf0GhC5hhvug8GnS0QU4FQSHwUWySLA11+Tsajjssm8VDr18SJcT9Zr6Vze3Cqm5jp2qEHc3xBYd6G/k1STTzkL/6fR/F1LJVvho6baVTc8OHbdBYezZ3hC3W8n4opjEMA5rwVh3RYnik/Cd1U0y02Nwrn3OfJDtir9tBSAf/iZrkZcfAfaZ5w+lLsE09f9alzajCabmuOwPr3XeLRPaCdddzs7wncnz3dJxW8Y4rTt/qVnzJtmELNsiLGsknIR/wTpV50LsoNQTMGeYo86VxNA== X-MS-Exchange-CrossTenant-Network-Message-Id: 374004a0-449b-4ad6-fbc0-08df5192c29a X-MS-Exchange-CrossTenant-AuthSource: MW3PR11MB4684.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 23:11:28.3120 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 10clz4rM9wWwBv0TB3FR5PzEwiQpYgEE03iWIxbP3UERhiQxtijFczCa/wobjWZANQyCEHP4U+dJ45qe2C6w/Al2iX4WHs91RpFd/pbLt1satyiqSnfr7dGzq7x8CCjF X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR11MB7139 X-OriginatorOrg: intel.com On Thu, Dec 03, 2026 at 12:23:25PM -0800, Matthew Brost wrote: >A defragmentation move relocates a populated tt into a freshly allocated >one so that sub-beneficial-order chunks can be upgraded to the device's >beneficial order. Previously, if allocation could not complete entirely >at beneficial order, the move failed and all progress was discarded. > >Instead, once allocation has successfully upgraded part of the object, >the remainder of the old tt is harvested to complete the new tt. Thread >the BO's old, still-populated tt into the page allocator via a new >ttm_operation_ctx::defrag_old_tt. While allocation is still proceeding, >any existing chunk already at (or above) the beneficial order is reused >directly instead of being reallocated. If allocation later has to fall >back below beneficial_order after making partial progress, the remainder >of the old tt is harvested instead of failing the move. This preserves >the beneficial-order upgrades already made while leaving the rest of the >object unchanged, allowing subsequent defragmentation attempts to make >additional forward progress. > >Harvesting only borrows the pages; they remain owned by the old tt until >the move commits. This keeps every unwind path non-destructive: if the >(re)allocation or the move later fails, the new tt is torn down without >freeing the borrowed pages and the old tt is restored fully intact. >Ownership of the shared pages is transferred to the new tt only once the >move has committed. ttm_tt_defrag_disown_borrowed() implements both >directions of the transfer by clearing a tt's slots for every page it >shares with the other tt (same struct page at the same index), so that >tt's teardown leaves the shared pages alone and each page is freed >exactly once by its owner: > >- on the alloc unwind and the failed-move paths, the new tt disowns the > borrowed pages, leaving the old tt as the sole owner; >- on the successful-move paths (synchronous teardown and the pipelined > ghost-object teardown), the old tt disowns the now-transferred pages, > leaving the new tt as the sole owner. > >Detecting shared pages by same-index struct page identity needs no extra >per-tt bookkeeping, since two distinct allocations never alias. This is >safe with drivers, such as Xe, that build their own per-tt sg table and >DMA-map it independently: each tt maps and unmaps its own sg, so sharing >the underlying pages between tts is DMA-clean. > >This is a no-op unless ctx->defrag_old_tt is set, which only happens on a >defragmentation move. > >v4: > - Check for backup handle in ttm_pool_harvest_remaining (Niranjana) >v5: > - Harden harvest code around index / order assumptions (Sashiko) > >Cc: Carlos Santa >Cc: Ryan Neph >Cc: Natalie Vock >Cc: Arun Pravin >Cc: Matthew Auld >Cc: Maarten Lankhorst >Cc: Maxime Ripard >Cc: Thomas Zimmermann >Cc: David Airlie >Cc: Simona Vetter >Cc: dri-devel@lists.freedesktop.org >Cc: linux-kernel@vger.kernel.org >Cc: Thomas Hellström >Signed-off-by: Matthew Brost LGTM. Reviewed-by: Niranjana Vishwanathapura >--- > drivers/gpu/drm/ttm/ttm_bo.c | 20 ++- > drivers/gpu/drm/ttm/ttm_bo_util.c | 5 + > drivers/gpu/drm/ttm/ttm_pool.c | 259 ++++++++++++++++++++++++++++-- > drivers/gpu/drm/ttm/ttm_tt.c | 67 ++++++++ > include/drm/ttm/ttm_bo.h | 12 ++ > include/drm/ttm/ttm_tt.h | 2 + > 6 files changed, 348 insertions(+), 17 deletions(-) > >diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c >index a32b78c80989..67a97a5e0dfb 100644 >--- a/drivers/gpu/drm/ttm/ttm_bo.c >+++ b/drivers/gpu/drm/ttm/ttm_bo.c >@@ -171,7 +171,14 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, > } > > if (defrag_old_tt || mem->mem_type != TTM_PL_SYSTEM) { >+ /* >+ * Let the page allocator harvest already >+ * beneficial-order chunks out of the old tt to back >+ * the new one, rather than reallocating them. >+ */ >+ ctx->defrag_old_tt = defrag_old_tt; > ret = ttm_bo_populate(bo, ctx); >+ ctx->defrag_old_tt = NULL; > if (ret) { > /* > * Discharge the freshly allocated backing and >@@ -221,6 +228,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, > } > > if (bo->defrag_old_tt) { >+ /* >+ * Successful defrag move: any pages the new tt borrowed from the >+ * old tt are now owned by the new tt. Disown them from the old >+ * tt before it is torn down so they are not freed. >+ */ >+ ttm_tt_defrag_disown_borrowed(bo->defrag_old_tt, bo->ttm); > ttm_tt_unpopulate(bo->bdev, bo->defrag_old_tt); > ttm_tt_destroy(bo->bdev, bo->defrag_old_tt); > bo->defrag_old_tt = NULL; >@@ -231,7 +244,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, > > out_err: > if (bo->defrag_old_tt) { >- /* Failed defrag move: restore the original backing. */ >+ /* >+ * Failed defrag move: drop any pages the new tt borrowed from >+ * the old tt (still owned by the old tt) before destroying the >+ * new tt, then restore the original backing. >+ */ >+ ttm_tt_defrag_disown_borrowed(bo->ttm, bo->defrag_old_tt); > ttm_bo_tt_destroy(bo); > bo->ttm = bo->defrag_old_tt; > bo->defrag_old_tt = NULL; >diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c >index 21a25048d64d..4799b06fbb1a 100644 >--- a/drivers/gpu/drm/ttm/ttm_bo_util.c >+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c >@@ -660,7 +660,12 @@ static int ttm_bo_move_to_ghost(struct ttm_buffer_object *bo, > * tt (the move's source) to the ghost so it is kept populated > * until @fence signals and then unbound and destroyed, instead > * of being torn down synchronously. @bo keeps its new tt. >+ * >+ * Any pages the new tt borrowed from the old tt are now owned by >+ * the new tt; disown them from the old tt so the ghost teardown >+ * leaves them alone. > */ >+ ttm_tt_defrag_disown_borrowed(bo->defrag_old_tt, bo->ttm); > ghost_obj->ttm = bo->defrag_old_tt; > ghost_obj->defrag_old_tt = NULL; > bo->defrag_old_tt = NULL; >diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c >index 5c7fec62aa30..facff745cc7d 100644 >--- a/drivers/gpu/drm/ttm/ttm_pool.c >+++ b/drivers/gpu/drm/ttm/ttm_pool.c >@@ -808,6 +808,160 @@ static unsigned int ttm_pool_alloc_find_order(unsigned int highest, > return min_t(unsigned int, highest, __fls(alloc->remaining_pages)); > } > >+/* >+ * Defragmentation page harvesting. >+ * >+ * A defrag move relocates a populated tt into a freshly allocated one in order >+ * to upgrade sub-beneficial-order chunks to the device's beneficial order. >+ * Chunks in the old tt (ctx->defrag_old_tt) that are ALREADY at the beneficial >+ * order do not need to be reallocated: their physical pages can simply be >+ * transferred ("harvested") into the new tt at the same offset, avoiding the >+ * alloc/free churn that is significant for large buffers. >+ * >+ * Harvesting only borrows the pages: the new tt simply references the old tt's >+ * pages, which remain owned by the old tt. This keeps the unwind paths simple - >+ * if the (re)allocation or the move later fails, the new tt is torn down without >+ * freeing the borrowed pages and the old tt is restored fully intact. Ownership >+ * of the shared pages is transferred to the new tt only once the move has >+ * committed, via ttm_tt_defrag_disown_borrowed() (see ttm_tt.c). >+ */ >+ >+/* >+ * Return the allocation order of the old tt chunk whose head sits at @off, or 0 >+ * if the slot is empty / backed up. @cursor monotonically tracks the old chunk >+ * boundary and must be advanced past every offset that has already been >+ * queried; a page order may only be read from a chunk head page, hence the lazy >+ * walk. >+ * >+ * Old tt chunks are self-aligned (see __ttm_pool_alloc()) and defrag only ever >+ * advances @off by whole old chunks or by fresh chunks at least as large as the >+ * old chunks they replace, so @off is always an old chunk boundary. Should that >+ * invariant ever break, borrowing from @off would split an old chunk (treating >+ * its tail pages as order-0 chunks) and corrupt page ownership between the old >+ * and new tt, so fail the move instead. >+ * >+ * Returns: the old chunk order, or -EINVAL if @off is not an old chunk head. >+ */ >+static int ttm_pool_defrag_old_order(struct ttm_pool *pool, >+ struct ttm_tt *old_tt, >+ pgoff_t off, pgoff_t *cursor) >+{ >+ struct page *p; >+ >+ while (*cursor < off) { >+ p = old_tt->pages[*cursor]; >+ *cursor += (!p || ttm_backup_page_ptr_is_handle(p)) ? 1 : >+ 1UL << ttm_pool_page_order(pool, p); >+ } >+ >+ if (WARN_ON_ONCE(*cursor != off)) >+ return -EINVAL; >+ >+ p = old_tt->pages[off]; >+ if (!p || ttm_backup_page_ptr_is_handle(p)) >+ return 0; >+ >+ return ttm_pool_page_order(pool, p); >+} >+ >+/* >+ * Borrow an already beneficial-order chunk from the old tt into @alloc. The >+ * pages stay owned by the old tt until the move commits. >+ */ >+static int ttm_pool_harvest_page(struct ttm_tt *old_tt, unsigned int order, >+ pgoff_t off, struct ttm_pool_alloc_state *alloc) >+{ >+ pgoff_t nr = 1UL << order; >+ int r; >+ >+ /* >+ * A harvested chunk keeps the (same) bo's caching, so the deferred >+ * caching range is consistent here; flush it before committing, exactly >+ * like the caching-consistent path in ttm_pool_page_allocated(). >+ */ >+ r = ttm_pool_apply_caching(alloc); >+ if (r) >+ return r; >+ >+ /* >+ * The borrowed chunk's page pointers (consecutive struct pages of one >+ * compound allocation) and dma addresses already sit contiguously in >+ * the old tt at @off. Copy the whole run with memcpy() instead of the >+ * per-page increment loop in ttm_pool_allocated_page_commit(): for a >+ * large defrag the borrowed pages dominate the new tt, so this turns >+ * the populate fill from O(num_pages) individual stores into a handful >+ * of bulk copies. >+ */ >+ memcpy(alloc->pages, &old_tt->pages[off], nr * sizeof(*alloc->pages)); >+ alloc->pages += nr; >+ alloc->remaining_pages -= nr; >+ >+ if (alloc->dma_addr) { >+ memcpy(alloc->dma_addr, &old_tt->dma_address[off], >+ nr * sizeof(*alloc->dma_addr)); >+ alloc->dma_addr += nr; >+ } >+ >+ alloc->caching_divide = alloc->pages; >+ >+ return 0; >+} >+ >+static int ttm_pool_harvest_remaining(struct ttm_pool *pool, >+ struct ttm_tt *old_tt, pgoff_t off, >+ pgoff_t *cursor, >+ struct ttm_pool_alloc_state *alloc) >+{ >+ /* >+ * @off is always an old-tt chunk head here, never a tail page. This >+ * holds because: >+ * - Old chunks are self-aligned: the order walk in __ttm_pool_alloc() >+ * is non-increasing and starts at an order the current offset is >+ * aligned to, so an order-k chunk sits at a 2^k-aligned offset. >+ * - Fresh defrag allocations are only made where the old chunk is >+ * below the beneficial order, at an order >= the beneficial order >+ * and aligned to it, so they cover whole old chunks and never stop >+ * in the middle of one; old chunks at or above the beneficial order >+ * are always harvested whole by ttm_pool_iter_reuse_old(). >+ * ttm_pool_defrag_old_order() verifies this against @cursor and fails >+ * the move rather than ever borrowing a tail page. >+ */ >+ while (alloc->remaining_pages) { >+ int order = ttm_pool_defrag_old_order(pool, old_tt, off, >+ cursor); >+ pgoff_t nr; >+ int r; >+ >+ if (order < 0) >+ return order; >+ nr = 1UL << order; >+ >+ r = ttm_pool_harvest_page(old_tt, order, off, alloc); >+ if (r) >+ return r; >+ >+ off += nr; >+ } >+ >+ return 0; >+} >+ >+/** >+ * enum ttm_pool_iter_action - Outcome of a per-order allocation phase >+ * @TTM_POOL_ITER_FILL: A page (@it->p) was acquired; proceed to fill it in. >+ * @TTM_POOL_ITER_RETRY: Loop state was adjusted (e.g. order lowered or a chunk >+ * harvested); re-enter the loop body for the next order. >+ * @TTM_POOL_ITER_STOP: The allocation is complete; stop the loop. >+ * >+ * Phase helpers return one of these (>= 0) on success, or a negative errno on >+ * failure (the caller then unwinds via error_free_all). >+ */ >+enum ttm_pool_iter_action { >+ TTM_POOL_ITER_FILL, >+ TTM_POOL_ITER_RETRY, >+ TTM_POOL_ITER_STOP, >+}; >+ > /* > * struct ttm_pool_alloc_iter - Working state for the __ttm_pool_alloc() loop > * >@@ -821,6 +975,7 @@ struct ttm_pool_alloc_iter { > struct ttm_tt *tt; > const struct ttm_operation_ctx *ctx; > struct ttm_pool_alloc_state *alloc; >+ struct ttm_tt *defrag_old_tt; > unsigned int beneficial_order; > gfp_t gfp_flags; > >@@ -829,9 +984,52 @@ struct ttm_pool_alloc_iter { > enum ttm_caching page_caching; > bool allow_pools; > bool fail_beneficial; >+ unsigned int alloc_count; >+ pgoff_t old_cursor; > struct page *p; > }; > >+/* >+ * Defrag move: reuse an already beneficial-order chunk from the old tt at this >+ * offset rather than reallocating it. Harvest whatever order the old chunk has >+ * (>= beneficial order), which may exceed the order the new tt would otherwise >+ * pick. An order below beneficial_order is only reused for the unaligned tail >+ * (where there is no benefit to reallocating). Only borrows the pages; the alloc >+ * unwind path can drop them again. >+ * >+ * Returns TTM_POOL_ITER_RETRY when a chunk was harvested, TTM_POOL_ITER_FILL to >+ * fall back to a fresh allocation, or a negative errno. >+ */ >+static int ttm_pool_iter_reuse_old(struct ttm_pool_alloc_iter *it) >+{ >+ int harvest_order; >+ pgoff_t off; >+ int r; >+ >+ if (!it->defrag_old_tt || !it->beneficial_order) >+ return TTM_POOL_ITER_FILL; >+ >+ off = it->tt->num_pages - it->alloc->remaining_pages; >+ harvest_order = ttm_pool_defrag_old_order(it->pool, it->defrag_old_tt, >+ off, &it->old_cursor); >+ if (harvest_order < 0) >+ return harvest_order; >+ >+ if (harvest_order < it->beneficial_order && >+ it->order >= it->beneficial_order) >+ return TTM_POOL_ITER_FILL; >+ >+ it->order = harvest_order; >+ r = ttm_pool_harvest_page(it->defrag_old_tt, it->order, off, it->alloc); >+ if (r) >+ return r; >+ >+ it->page_caching = it->tt->caching; >+ it->allow_pools = true; >+ >+ return TTM_POOL_ITER_RETRY; >+} >+ > /* > * Acquire a single page for the current order, leaving it in @it->p (NULL on > * failure). Tries a same-order pool page, then a fresh system allocation. Fault >@@ -874,9 +1072,10 @@ static void ttm_pool_iter_acquire_page(struct ttm_pool_alloc_iter *it) > /* > * The current order could not be satisfied. Lower it and retry, recording a > * sub-optimal backing (so the driver can later re-defrag) when we drop below >- * the beneficial order. >+ * the beneficial order. For a defrag move that has already made partial >+ * progress, harvest the remaining old pages and stop instead. > * >- * Returns 0 to retry the (lowered) order, or a negative errno. >+ * Returns TTM_POOL_ITER_RETRY, TTM_POOL_ITER_STOP, or a negative errno. > */ > static int ttm_pool_iter_lower_order(struct ttm_pool_alloc_iter *it) > { >@@ -886,21 +1085,30 @@ static int ttm_pool_iter_lower_order(struct ttm_pool_alloc_iter *it) > if (!it->order) > return -ENOMEM; > >- /* >- * Failing to allocate at the device's beneficial order means we are >- * about to back this object with a sub-optimal (smaller order) set of >- * pages. Record it so the driver can later try to defragment the object >- * back to beneficial order. >- */ > if (it->fail_beneficial || at_beneficial) { > it->tt->page_flags |= TTM_TT_FLAG_BENEFICIAL_ORDER_FAILED; > >- /* >- * If we are defragmenting, we only want beneficial_order, so >- * any failure is treated as -ENOMEM. >- */ >- if (it->ctx->defrag) >+ if (it->alloc_count && it->defrag_old_tt) { >+ pgoff_t off = it->tt->num_pages - >+ it->alloc->remaining_pages; >+ int r; >+ >+ r = ttm_pool_harvest_remaining(it->pool, >+ it->defrag_old_tt, off, >+ &it->old_cursor, >+ it->alloc); >+ if (r) >+ return r; >+ >+ return TTM_POOL_ITER_STOP; >+ } else if (it->defrag_old_tt) { >+ /* >+ * If we are defragmenting, we only want >+ * beneficial_order, so any failure is treated as >+ * -ENOMEM. >+ */ > return -ENOMEM; >+ } > } > > if (it->fail_beneficial) >@@ -910,7 +1118,7 @@ static int ttm_pool_iter_lower_order(struct ttm_pool_alloc_iter *it) > it->page_caching = it->tt->caching; > it->allow_pools = true; > >- return 0; >+ return TTM_POOL_ITER_RETRY; > } > > static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, >@@ -923,6 +1131,7 @@ static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > .tt = tt, > .ctx = ctx, > .alloc = alloc, >+ .defrag_old_tt = restore ? NULL : ctx->defrag_old_tt, > .beneficial_order = ttm_pool_beneficial_order(pool), > .page_caching = tt->caching, > .allow_pools = true, >@@ -955,6 +1164,7 @@ static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > * starts at an order @off is aligned to. @off is only non-zero when > * resuming an interrupted restore, which would otherwise restart at > * MAX_PAGE_ORDER and could place a large chunk at an unaligned offset. >+ * Defrag relies on this to borrow whole old chunks. > */ > if (off) > start_order = min_t(unsigned int, start_order, __ffs(off)); >@@ -962,13 +1172,22 @@ static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > for (it.order = ttm_pool_alloc_find_order(start_order, alloc); > alloc->remaining_pages; > it.order = ttm_pool_alloc_find_order(it.order, alloc)) { >+ /* Reuse an already beneficial-order chunk from the old tt. */ >+ r = ttm_pool_iter_reuse_old(&it); >+ if (r < 0) >+ goto error_free_all; >+ if (r == TTM_POOL_ITER_RETRY) >+ continue; >+ > /* Acquire a page (pool / system) for this order. */ > ttm_pool_iter_acquire_page(&it); > if (!it.p) { > r = ttm_pool_iter_lower_order(&it); >- if (r) >+ if (r < 0) > goto error_free_all; >- continue; >+ if (r == TTM_POOL_ITER_RETRY) >+ continue; >+ break; /* TTM_POOL_ITER_STOP */ > } > > r = ttm_pool_page_allocated(pool, it.order, it.p, >@@ -982,6 +1201,8 @@ static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > if (r) > goto error_free_all; > } >+ >+ it.alloc_count++; > } > > r = ttm_pool_apply_caching(alloc); >@@ -1000,6 +1221,12 @@ static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > if (tt->restore) > return r; > >+ /* >+ * Drop any pages borrowed from the old tt during a defrag move: they are >+ * still owned by the old tt and must not be freed here. >+ */ >+ ttm_tt_defrag_disown_borrowed(tt, it.defrag_old_tt); >+ > caching_divide = alloc->caching_divide - tt->pages; > ttm_pool_free_range(pool, tt, tt->caching, 0, caching_divide); > ttm_pool_free_range(pool, tt, ttm_cached, caching_divide, >diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c >index b645a1818184..2388ff794a59 100644 >--- a/drivers/gpu/drm/ttm/ttm_tt.c >+++ b/drivers/gpu/drm/ttm/ttm_tt.c >@@ -450,6 +450,73 @@ void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm) > } > EXPORT_SYMBOL_FOR_TESTS_ONLY(ttm_tt_unpopulate); > >+/** >+ * ttm_tt_defrag_disown_borrowed() - Drop borrowed defrag pages from a tt >+ * @tt: The tt to drop the borrowed page references from. >+ * @src: The tt the pages may have been harvested from, or NULL. >+ * >+ * During a defragmentation move the freshly (re)allocated tt may harvest >+ * already beneficial-order chunks from the BO's old tt, sharing the underlying >+ * pages instead of reallocating them. Until the move commits these pages stay >+ * owned by the old tt. Clearing a tt's slots for every page it shares with >+ * @src (the same struct page at the same index) makes that tt's teardown leave >+ * the shared pages alone, so they are freed exactly once by their owner. >+ * >+ * This is used both to unwind a failed defrag move (disown the borrowed pages >+ * from the new tt, leaving the old tt intact) and to commit a successful one >+ * (disown the now-transferred pages from the old tt, leaving them owned by the >+ * new tt). >+ */ >+void ttm_tt_defrag_disown_borrowed(struct ttm_tt *tt, const struct ttm_tt *src) >+{ >+ pgoff_t i = 0, run_start = 0; >+ bool in_run = false; >+ >+ if (!tt || !src) >+ return; >+ >+ /* >+ * Borrowing happens at chunk granularity: a borrowed chunk shares the >+ * same struct page on both tts across its whole allocation order, while >+ * a non-borrowed chunk differs across its whole order. Stride by @src's >+ * chunk order instead of walking every page, coalescing the borrowed >+ * (matching) chunks into runs and clearing each run with a single >+ * memset rather than a per-page store. @src is a fully populated, >+ * non-dma_alloc tt (the defrag path), so its page order is recorded in >+ * page->private and read via ttm_pool_page_order_nodma(). >+ */ >+ while (i < tt->num_pages) { >+ struct page *sp = src->pages[i]; >+ unsigned int order = sp ? ttm_pool_page_order_nodma(sp) : 0; >+ pgoff_t nr = 1UL << order; >+ >+ if (sp && tt->pages[i] == sp) { >+ if (!in_run) { >+ run_start = i; >+ in_run = true; >+ } >+ } else if (in_run) { >+ memset(&tt->pages[run_start], 0, >+ (i - run_start) * sizeof(*tt->pages)); >+ if (tt->dma_address) >+ memset(&tt->dma_address[run_start], 0, >+ (i - run_start) * >+ sizeof(*tt->dma_address)); >+ in_run = false; >+ } >+ >+ i += nr; >+ } >+ >+ if (in_run) { >+ memset(&tt->pages[run_start], 0, >+ (i - run_start) * sizeof(*tt->pages)); >+ if (tt->dma_address) >+ memset(&tt->dma_address[run_start], 0, >+ (i - run_start) * sizeof(*tt->dma_address)); >+ } >+} >+ > #ifdef CONFIG_DEBUG_FS > > /* Test the shrinker functions and dump the result */ >diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h >index c5205b8e8f10..22d12fea6f3c 100644 >--- a/include/drm/ttm/ttm_bo.h >+++ b/include/drm/ttm/ttm_bo.h >@@ -211,6 +211,18 @@ struct ttm_operation_ctx { > * order. > */ > bool defrag; >+ /** >+ * @defrag_old_tt: During a defragmentation move, the bo's existing >+ * (populated) tt that is being relocated. The page allocator may >+ * harvest already beneficial-order chunks from this tt to back the new >+ * tt instead of reallocating them, avoiding alloc/free churn for large >+ * buffers. Harvested pages are only borrowed: they stay owned by >+ * @defrag_old_tt until the move commits, at which point >+ * ttm_tt_defrag_disown_borrowed() clears the old tt's slots for the >+ * transferred pages so they are not freed when the old tt is torn down. >+ * NULL for non-defrag operations. >+ */ >+ struct ttm_tt *defrag_old_tt; > /** > * @resv: Reservation object to be used together with > * @allow_res_evict. >diff --git a/include/drm/ttm/ttm_tt.h b/include/drm/ttm/ttm_tt.h >index ce7533677d77..55c35bcf134d 100644 >--- a/include/drm/ttm/ttm_tt.h >+++ b/include/drm/ttm/ttm_tt.h >@@ -284,6 +284,8 @@ int ttm_tt_populate(struct ttm_device *bdev, struct ttm_tt *ttm, > */ > void ttm_tt_unpopulate(struct ttm_device *bdev, struct ttm_tt *ttm); > >+void ttm_tt_defrag_disown_borrowed(struct ttm_tt *tt, const struct ttm_tt *src); >+ > /** > * ttm_tt_mark_for_clear - Mark pages for clearing on populate. > * >-- >2.34.1 >