From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9827434678E for ; Tue, 7 Apr 2026 17:34:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=192.198.163.17 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775583279; cv=fail; b=ZE/HBBPtbrs2BuZi4v9t7IWM/Ah9t7rSrm0aoAKRjThl3cYBx3zNM/6vQF590zl2Mpc5PpVAkt2xwTjoONeCWIB3LzevEugl2DCdxELG2z7P9RmMzi2R86j80OmZVzfPe9bUE3+TxHUQlwsbDHiKPMmOjbV1wBt1Nv98YumpBh8= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775583279; c=relaxed/simple; bh=wtz2HWVg3aAGmFjJouFNjLScEtb/N4Dh7N8CGt0Wpbw=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=WuaWoFHRHblmuyCKhcwqzjYEstpvUTYcJNnewKP0AlVFjXYj+vErz7cthLaEQpOa8sfEFT0cBVY0Va6+oZT5hmAarbeAxP6miZ5VSXMLiQc/w9nTdUl2Al72dSMr3d0AGKKiI8J7nnhsm9scETctIvwh2Wgowpgqd9anj1AL3ps= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ei0oiDVm; arc=fail smtp.client-ip=192.198.163.17 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.b="ei0oiDVm" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1775583277; x=1807119277; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=wtz2HWVg3aAGmFjJouFNjLScEtb/N4Dh7N8CGt0Wpbw=; b=ei0oiDVmXwbujQhH/4TixnxXwcM7ma2Mic5ayKYqg/ddaCNwqh674vUC ucVOaTK+QAoskyCwNojTsLl6WotEvUhxHToRA3eO2jzPxTYLY/NuSlPvi VAcfU+/ccn4hVmwcr7nWyedrXmjhl/Rp/ncWgrVQTUuqhQHl6VuQq3pXh IJfXem59DgDiLe1FblZ46W1gs7OnGW0Au0BLY5ZNnx+sYmXQUROv0IOyb pssrsgYnyf+faZcFO84kbeVNPRjor5JbANyW9gyAnfTuDh/Yiq9WVyAfR /+RMC/YKhvF+FHGKLxtZsS9I3ZrL8t1h2f0fhZnAfAcAyklKNkYCrif55 g==; X-CSE-ConnectionGUID: f8rgCQS6T4amaYrJa+XIOg== X-CSE-MsgGUID: PghJZ+7NQWiInS8Uqe+wGw== X-IronPort-AV: E=McAfee;i="6800,10657,11752"; a="76447365" X-IronPort-AV: E=Sophos;i="6.23,166,1770624000"; d="scan'208";a="76447365" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2026 10:34:32 -0700 X-CSE-ConnectionGUID: gv+EneftSVaYcskOTUBprw== X-CSE-MsgGUID: 4JPZka7pTkCzDqmTOUCUNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,166,1770624000"; d="scan'208";a="251526182" Received: from orsmsx901.amr.corp.intel.com ([10.22.229.23]) by fmviesa001.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2026 10:34:32 -0700 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.37; Tue, 7 Apr 2026 10:34:31 -0700 Received: from ORSEDG903.ED.cps.intel.com (10.7.248.13) 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.37 via Frontend Transport; Tue, 7 Apr 2026 10:34:31 -0700 Received: from CY7PR03CU001.outbound.protection.outlook.com (40.93.198.3) by edgegateway.intel.com (134.134.137.113) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.37; Tue, 7 Apr 2026 10:34:30 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Y0X0IAQZ5W8TSN7fw7IAyYgRg2LyQEyaDvoaKIeo8NwRN7bnqWd/lBzxWPVKB7p8WRgzj/hU8/NnHeFWu/508A85KDWy/XHhA0Q/HeQYnpcgH2r7rnHbcczh4LHHLMYPJ0tKP6jI5OZTZwYHgirSfe5gVnzIVk5FAk8w8T988iMj2k1/Pfk3loMKAYHLqFc5Q+qQWy9O4BoIL9B1qEhmvADAhomL0JLXdieMwecfAsYxGqPMm0RLs99sdOcMIdhmtKMUJonfd/g63gCMMo843nzKCquqr0ggjdr1A/RuGr4jI8bCHhSvOj/0CDb7OfibscfNcDp93C5ePG/l3Zo0Rw== 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=YA0smrHLpEwpzTx4tlxwsv1AfH4ynUS7BG7GWFgKOE8=; b=ljsF6MUhfOTI2PtS9X5CE+PWdGd+DY4aSzVc4vrQB6OHI+6gaUmyi8UZoHsJRWItkJNdXmwBtuob5WSuczoKZYwJ2bJHeSEVehuRK8PKmUAJQNOCHburIcNBiZGBJXlF+nFT9wlinq1Y4e5BlGX4ENGEo7wH1HmwRNWT5Lxvywp88KplJTV/Dq6zZT1PQs+mPTsnB/GLV8dfuLWfVVn7iu/C/o1P+D81LdeIGJZknUTN7F5TzEhLCdrRq+shScbP1HMe4eTQE1A6t0/oXVBaEUwltQXbPFEGC5NLWb+gYaWM7sDFg/3VnRrzvkPtu75qblpPsjNmW/xXoEyDeJ1alw== 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: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from BL3PR11MB6508.namprd11.prod.outlook.com (2603:10b6:208:38f::5) by DM4PR11MB6237.namprd11.prod.outlook.com (2603:10b6:8:a9::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.15; Tue, 7 Apr 2026 17:34:26 +0000 Received: from BL3PR11MB6508.namprd11.prod.outlook.com ([fe80::53c9:f6c2:ffa5:3cb5]) by BL3PR11MB6508.namprd11.prod.outlook.com ([fe80::53c9:f6c2:ffa5:3cb5%7]) with mapi id 15.20.9769.016; Tue, 7 Apr 2026 17:34:26 +0000 Date: Tue, 7 Apr 2026 10:34:22 -0700 From: Matthew Brost To: Christian =?iso-8859-1?Q?K=F6nig?= CC: Daniel Colascione , , , Huang Rui , Matthew Auld , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Thomas =?iso-8859-1?Q?Hellstr=F6m?= , Subject: Re: [RFC PATCH] Limit reclaim to avoid TTM desktop stutter under mem pressure Message-ID: References: <87341fsa85.fsf@dancol.org> Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: SJ2PR07CA0005.namprd07.prod.outlook.com (2603:10b6:a03:505::29) To BL3PR11MB6508.namprd11.prod.outlook.com (2603:10b6:208:38f::5) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL3PR11MB6508:EE_|DM4PR11MB6237:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dd421c2-478c-4ac6-429e-08de94cbea4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024|7416014|18002099003|56012099003|22082099003; X-Microsoft-Antispam-Message-Info: BQ67M+hTprnBJ/yLy7EO8S8TOGk3aGSumKYO1gNFf0+7mSFLVj1Vjj0r5jLsIYkALtstHArBh99/9xRysAYUecY5KImEXM4Yvr1ZkIyxDzl8Uah6KDcKMCqUdRWxsbZ7qms3FP0x0o9zoG2URbMea/fEjxLsN2IqSkaCfFGXqRR1JhTQLrJM75G/re/vcnaCyArc8c1fYU/wuqsACIu9by61CNW1+NwH7m6Y3LcRnwTHr/wwuy+91BcY8NRrmJuZxPTZeclyLmchrolFfKBOta7U/M8ggv3C86GjPL5LrPSMygrIiL7D7ZCgUcCkNJD/XoFA/REdTfQmRDGI24+2PmwtqR2YNRzQ5XV4Ak7J/auNVbHWzjO7XMvJwUQmFPlkvKTe7NFmI4Cw+XltkDKq0nnb3j7l61O2QQYjWxktsoGUqEFbSpAN+IY7xP9PGwTKDkkZMZLHvU5jSTbeGekURENL9hms/a6XVKyEf3zc/WwIdSYA0iRMh6jacfvJ5BT1LXWxsm5qP/8X71BsLc7DWXYStUu0p/+XGadyp9jBIbW/7GoMChU+tHHxtarGEmvPN6LxwVx0RPFy+QRN32GMimVfFAzEa5E+jJksiY9LNQx3tHlxN7Bk+LMzocTsKNcymzqQcLEZELpHvFVBcWnuPe+VtryBHJRVZrzb+Yxpe7S3gQKJaqL9EB9T5YCJFo+5FnFrLpiETwdCaSaYS/mi/+7J7fy6FThQFKcJNYWRd6s= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BL3PR11MB6508.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(7416014)(18002099003)(56012099003)(22082099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?d3BsYURGVkFrSFA2RGdxK00wbWp3dkxJdjl0QUNaZGI3c2I0NzI5R2lpbnRX?= =?utf-8?B?dnZnNkNsbTBIVFJQQ1k5NUtJc3psMm5hdS9VUXB2MmRGTUN1Z3oyZlpPYXh1?= =?utf-8?B?Qzdqb2gvOEkycEhhTW5uazU2N2c0cGRBMkQyZFVnMDh2K1B6a2piLzM4bkdT?= =?utf-8?B?OTVsckFTdlAxVE5qanJHWnFjUjh3MHV5a1R3bGluUTZMMEhUWlNRNmZuWDJo?= =?utf-8?B?ZkZQREJnUDJUbFNTNmNvVGI5OGxWd2grVEc4L0Z3U2doUHovZTJDZTh3L0VO?= =?utf-8?B?OU55NHp2OVM0cjZoTFBtdFVMQldiUzBJQnJOWVZpWDhEZkUwdG40eU90TWQw?= =?utf-8?B?c2FWRGlodk92QSswMXVLd2hUWFJCOWsxQ1dqR2ZwYVQxdDExSUpRbEpldFM2?= =?utf-8?B?RmVHSVZUNWF3MW1OdkVKNEtUekM2ZThodExWRnVDYUdlSUpZWmdnaU9jZ0sz?= =?utf-8?B?Unc5QXJYUDRoNXJxK1cvb09sdk12UHB6T3c3cTd1K05FVGJ4NUNsTkVReWFi?= =?utf-8?B?Z2VVYjV1QWcrcW8wMlpqMENPaUN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C1o4A8bAVKjPYNYs/5X22LURUxgyiYaoIh5q3Mg/tYIIE50Dx8aHq6RqM+Yn8pBUyXmna6jTrpSyavhPuZAi3bh7HYhZj/hEG3OonIEqhYpfcgh2Ecz9w9YAafO/LEvDwncgYzQzUntPv9dHqGCciwujal7jz+Ao5BA9H3CX7MDZ2HgOZTFRfVqNCLqs7mz6gHuJwDom4LfiIgddDPNttZBBSJ3/wtN9LUgBqiHEeDxWAxhUljCW4TfRTw0Tv/xWJr+HhTFfjzIHZQvCKplxA1yNkHeaaTMIBqs8/PZ378ALaeJAmgEI2j0Fjdmc5dXsm446uHs2oPtMw== X-MS-Exchange-CrossTenant-Network-Message-Id: 5dd421c2-478c-4ac6-429e-08de94cbea4e X-MS-Exchange-CrossTenant-AuthSource: BL3PR11MB6508.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Apr 2026 17:34:26.5227 (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: 88LIXrZVoSPwkPOhClrguiCgCIN43OfMt+NjAwQBn2S3uJCv2x7PcdFTJ1HtIL/X9HhvJS3VInoummpXuijqpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR11MB6237 X-OriginatorOrg: intel.com On Tue, Apr 07, 2026 at 09:43:30AM +0200, Christian König wrote: > On 4/6/26 23:02, Matthew Brost wrote: > > On Tue, Mar 31, 2026 at 10:08:58PM -0400, Daniel Colascione wrote: > ... > >> - > >> - /* > >> - * Do not add latency to the allocation path for allocations orders > >> - * device tolds us do not bring them additional performance gains. > >> - */ > >> - if (beneficial_order && order > beneficial_order) > >> - gfp_flags &= ~__GFP_DIRECT_RECLAIM; > >> + if (beneficial_order && order > beneficial_order) > >> + gfp_flags &= ~__GFP_DIRECT_RECLAIM; > >> + if (order > max_reclaim_order) > >> + gfp_flags &= ~__GFP_RECLAIM; > > > > I’m not very familiar with this code, but at first glance it doesn’t > > seem quite right. > > > > Would setting Xe’s beneficial to 9, similar to AMD’s, along with this > > diff, help? > > No, not really. The problem is that giving 9 as beneficial order only saves us avoiding direct reclaim for 10 (>=11 is usually not used in a x86 linux kernel anyway). > Yes, the first snippet was a bit incomplete. I adjusted it in a self-reply, but that likely still isn’t exactly right either. I’ll also take a look at how reclaim works at higher orders and how kswapd behaves there—I’m shooting from the hip a bit at the moment. > > > > If I’m understanding this correctly, we would try a single allocation > > attempt with __GFP_DIRECT_RECLAIM cleared for the size we care about, > > still attempt allocations from the pools, and then finally fall back to > > allocating single pages one at a time. > > Well the code is a bit broken, but the general idea is not so bad. > > What we could do is to use beneficial_order as sweet spot and set __GFP_DIRECT_RECLAIM only for the allocations with that order. > That’s roughly what my follow-up snippet did, but with __GFP_DIRECT_RECLAIM replaced by __GFP_KSWAPD_RECLAIM. I’m really not sure what the correct policy should be here. But in general I agree beneficial_order should be the sweet spot where we trigger some sort of reclaim. > This would skip setting it for order 1..8, which are nice to have as well but not so necessary that we always need to trigger reclaim for them. > This has made me think a bit further. I’m not really sure the current approach of TTM setting policy is actually the right choice—it might be better to give drivers more control so they can tune this themselves. Rough idea... struct ttm_pool_order_policy { bool enable; /* Should I call ttm_pool_alloc_page for an order */ gfp_t reclaim_mask; /* Used in ttm_pool_alloc_page &= ~reclaim_mask; */ }; Then, in ttm_pool_init, we could optionally pass in a table (0 → MAX_PAGE_ORDER) that controls the allocation pipeline in __ttm_pool_alloc. This may be overkill, and it still wouldn’t provide per-BO control, which might be desirable for cases like compositors versus compute workloads, etc. What do you think? Matt > Regards, > Christian. > > > > > Matt > > > > diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c > > index aa41099c5ecf..f1f430aba0c1 100644 > > --- a/drivers/gpu/drm/ttm/ttm_pool.c > > +++ b/drivers/gpu/drm/ttm/ttm_pool.c > > @@ -714,6 +714,7 @@ static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > > struct ttm_pool_alloc_state *alloc, > > struct ttm_pool_tt_restore *restore) > > { > > + const unsigned int beneficial_order = ttm_pool_beneficial_order(pool); > > enum ttm_caching page_caching; > > gfp_t gfp_flags = GFP_USER; > > pgoff_t caching_divide; > > @@ -757,7 +758,8 @@ static int __ttm_pool_alloc(struct ttm_pool *pool, struct ttm_tt *tt, > > if (!p) { > > page_caching = ttm_cached; > > allow_pools = false; > > - p = ttm_pool_alloc_page(pool, gfp_flags, order); > > + if (!order || order >= beneficial_order) > > + p = ttm_pool_alloc_page(pool, gfp_flags, order); > > } > > /* If that fails, lower the order if possible and retry. */ > > if (!p) { > > > > > >> + } > >> > >> if (!ttm_pool_uses_dma_alloc(pool)) { > >> p = alloc_pages_node(pool->nid, gfp_flags, order); >