From patchwork Mon Jul 8 16:06:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rajneesh Bhardwaj X-Patchwork-Id: 13726828 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id C0DBBC3271E for ; Mon, 8 Jul 2024 16:06:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 440B010E3A1; Mon, 8 Jul 2024 16:06:57 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="NEW9M+2P"; dkim-atps=neutral Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2043.outbound.protection.outlook.com [40.107.223.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id BE20C10E3A1; Mon, 8 Jul 2024 16:06:55 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WzlO8MnlkQy3aM0862oCLJeSvRol7avRPuJUoqlzWaybLBUhSw9bhMifYpVbnXsvL2h7b/kDQCIifsKYH+nPnJnENp3+67Q9U2OECRnbPw2ERVu1InYvd1KN73hPnLLko/At7uH11mW9LyJVkLNu+LbkBiXHDdUPFSAEl0CaU9gkE8bHi1/5ZpKLU5dwnexbOfvue2tY7O0FyVnBfGdrrt1i+kgj8dM7SbQs11JTBnmaFBfLjM5MlVhkKX91CUElD8NUKlkEZl01AX4CXc1WZqu4KJn8BhyX1pb3NUzUEOw45e8NhCXgjAJx5vDFD9sZnK74GckDZd0oKRw7SVK0lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=4aiVI42DDJEMwFbuZiQwGvsDBCvwpfUaSMaauB0Tzf0=; b=XcjJ6txD/WfSaIJjmSfTPCcDSxtr8yl6CEoZwpiU8LqGUv7gKfeLuGeRkeAJ8CxGnI4squSnDUNGoTjEAN6DGbbQf1NROm5xsO0dtvHJcFCElaUy3Sz9zlLYD/06ch9/crj/vQPIYMTyA+/WAhvBKQJbxZgTlgCiz9ripMAY08LNfrJiOVWPFUgNVBzPue9ZaX2AFENlGrESdnumU/Wae48ev/RJrQGS0Wi53zXUl85r7IThnCPI+yk+/ywNj5MOpza8/2qcEGQLcmy5L2SmIcZ1aMpCy3uRfRfWa6lL2DrztL78WELr6vMpl09hvkF+62JVdYLx6+fpr/U6wiL/Tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=4aiVI42DDJEMwFbuZiQwGvsDBCvwpfUaSMaauB0Tzf0=; b=NEW9M+2PqBehf4Rj1xCvcvYXmZk8GtAsJs3vP3vYZPW3/TyK3+H0dmitrFRsMw7CoYxeYMYmnxr2xrzTi9Wqq/QIFC6Un56kh2H+r7IfYSncVGYiCA+lVTdBo5IugQJz3YoTLGJnWx/MBIutMaYwwdIYPHapp00tM0Xjpji07ag= Received: from MW4PR03CA0115.namprd03.prod.outlook.com (2603:10b6:303:b7::30) by PH8PR12MB7112.namprd12.prod.outlook.com (2603:10b6:510:22c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.36; Mon, 8 Jul 2024 16:06:50 +0000 Received: from SJ5PEPF000001D4.namprd05.prod.outlook.com (2603:10b6:303:b7:cafe::b6) by MW4PR03CA0115.outlook.office365.com (2603:10b6:303:b7::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35 via Frontend Transport; Mon, 8 Jul 2024 16:06:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SJ5PEPF000001D4.mail.protection.outlook.com (10.167.242.56) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7762.17 via Frontend Transport; Mon, 8 Jul 2024 16:06:49 +0000 Received: from rajneesh-desk.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Mon, 8 Jul 2024 11:06:48 -0500 From: Rajneesh Bhardwaj To: , CC: , , , Rajneesh Bhardwaj , Dave Airlie , Vlastimil Babka , "Daniel Vetter" Subject: [Patch v2] drm/ttm: Allow direct reclaim to allocate local memory Date: Mon, 8 Jul 2024 12:06:36 -0400 Message-ID: <20240708160636.1147308-1-rajneesh.bhardwaj@amd.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D4:EE_|PH8PR12MB7112:EE_ X-MS-Office365-Filtering-Correlation-Id: 67a05b13-8152-4c0b-6f7c-08dc9f67f989 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?utf-8?q?Kysu7qvKqeFSymi2eC1g9G2khPzOdLw?= =?utf-8?q?sZbykicmlMpDsX2sosvWkK3ePolAfWlDQDRIT9Qa5Hr50Max3AP2k5/MGNvpHfdk5?= =?utf-8?q?umIRuaGT2gU5Lf0bAX9cd+e/YlUUgu4YNj1DQTvqAuLouzvlvE2FxyvHjLSAR8ZPo?= =?utf-8?q?awRQprFbHRcqhbV4gr2Udk5O7dUM5+QmiNknenAKLuLREBXfrNtKD6fW+kHu2tKbH?= =?utf-8?q?lsh7yCfQJ8MJhb7YakxLofO3TJfegt8b7XiM93jw5oV6KsFpc4DB0fRBvJkEKFRye?= =?utf-8?q?NEI9/Ss00OdGwYwZRpHehPM96bPG2T6kQqM82NhBsZaStofaCnRWPm53I8qNkyD9E?= =?utf-8?q?ylHL5Cks3UTWcPw+mYQNX34KFsOc1J/ORrCcnFm2TQb2bPkRiK0QTRsygeu1k3216?= =?utf-8?q?FQdtNogqnEqP3aI72iLYeFP2vp1/1X2ZZu8d2CMgN5x3m+Ri4xzuSEN86E5XCoB5t?= =?utf-8?q?UhqA55b6aE3+jeogpMTE0Q7S7eUXsgmJIWyk8fWFRQqxnhOXpImmfq98hgpn3qAbU?= =?utf-8?q?zE2T+p5YJsvj8XCGWFQ9aeyPVPK5EYcfGHnVaDRxZIKVcDIXsXNfV6lG/SB4fKOk6?= =?utf-8?q?VW4Tg4xngzr8lKT/XmERbsGneSUbY1RuwkA409ztIpYOFrz2PDOCWmBCtwg7luqXh?= =?utf-8?q?7q/e2W2QZotgB2c1TPms80M8eterY7RsS+rDCegFvAQ8Foa+B/qDizoFp5EAFXmuz?= =?utf-8?q?NTmB0B+i0SuDxztyiJ2sglohxrhx7GolonqkZdetlNsMpgGGeDCFYWNXHZ6oNATH3?= =?utf-8?q?LfA4hQPLoXqt/mG2lyDK1KddbCnk24RZcRDTPhokznwuiBobO88ZZkdF1xYtH6eCf?= =?utf-8?q?CyH+1g8RSwFtBJu1LziLnHRGcKrzyiH295YoPpH2/LhT12gm/IPIRPoNlu7NBgfov?= =?utf-8?q?GXhGu1FlOnWodLwyTtMROLwmVrh0qflgi+wbnuHLQvULtR6IXtnOC9g+cZMzFSI0F?= =?utf-8?q?eJouluSAn8zsvdgPyphLG8ZmcAZ/cE1n++7nlhuPUADTHiShTIO20/yBMbYwALoNk?= =?utf-8?q?yu0WQyW8hTG4xXf3znfuFTX3FeTcuj3CqRNmI/lVtLXa4mm4M9+F6ADvbF1HEvw0H?= =?utf-8?q?fP7hPMA2C0rRZA5FX3/Wxq0V6InILaW7qD+kDkElYfxzzKHCFplp2WmlHFToSIHVl?= =?utf-8?q?/GEgAPqz/ZaoFfmAb+7yAa0IVdEZ4U6t1I/dpmHqcIw5wyxDy/LRs2HEkkgHbIx/y?= =?utf-8?q?u9+/3KzuGs5ZZJffmp7hlNzmK9rpT/Q9UEFw+efhvuuHH9KUNY4PZ0XeW3/n7PFj8?= =?utf-8?q?jRkY3FSJONvLc+j4CW62l72IMVpilDF78JJCstXTtUBFAotnuokhv6qtSl3W3acxe?= =?utf-8?q?+Qkwab5pqNKm?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jul 2024 16:06:49.4093 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 67a05b13-8152-4c0b-6f7c-08dc9f67f989 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=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7112 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" Limiting the allocation of higher order pages to the closest NUMA node and enabling direct memory reclaim provides not only failsafe against situations when memory becomes too much fragmented and the allocator is not able to satisfy the request from the local node but falls back to remote pages (HUGEPAGE) but also offers performance improvement. Accessing remote pages suffers due to bandwidth limitations and could be avoided if memory becomes defragmented and in most cases without using manual compaction. (/proc/sys/vm/compact_memory) Note: On certain distros such as RHEL, the proactive compaction is disabled. (https://tinyurl.com/4f32f7rs) Cc: Dave Airlie Cc: Vlastimil Babka Cc: Daniel Vetter Reviewed-by: Christian König Signed-off-by: Rajneesh Bhardwaj --- drivers/gpu/drm/ttm/ttm_pool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/ttm/ttm_pool.c b/drivers/gpu/drm/ttm/ttm_pool.c index 6e1fd6985ffc..cc27d5c7afe8 100644 --- a/drivers/gpu/drm/ttm/ttm_pool.c +++ b/drivers/gpu/drm/ttm/ttm_pool.c @@ -91,7 +91,7 @@ static struct page *ttm_pool_alloc_page(struct ttm_pool *pool, gfp_t gfp_flags, */ if (order) gfp_flags |= __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN | - __GFP_KSWAPD_RECLAIM; + __GFP_RECLAIM | __GFP_THISNODE; if (!pool->use_dma_alloc) { p = alloc_pages_node(pool->nid, gfp_flags, order);