Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BCFD560A2607 for ; Tue, 27 Oct 2026 22:49:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=RLT44OQr Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8853B10E0AE; Tue, 27 Oct 2026 22:49:18 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by gabe.freedesktop.org (Postfix) with ESMTPS id 58E7110E4D1; Tue, 27 Oct 2026 22:49:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1793141352; x=1824677352; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=4osgydFKP9q7dfBxY1RYyGja1Q7a4PTd0+Lxe9xcnXg=; b=RLT44OQrpvat289swvdqhClxB6/o63yUfhqdOqR7t3xUF057kaoJ1Gbk fp8Ht1Mzqx2Kcg3hKO92K0iJJ9xHWBntXp9VSKDIoy3dUOsbUvGFMyaHB 9D2Vi0MIwQer/cw6zHBK7HBMIwapMl3PXBPt13X4VzhML6/lXgwJcjMZK s5k3TS0v4AZSdQo8d5wp+xXdW4N0nrLk1V7bsnp6AeA2kKpqdGc1AdUuZ pTjnqwvuwANFsMco7gPHSd9k61RegZPUWNLqrVo3OAWlayXSVnE9X8O9x NJ9eFAkYMPQlXGI0FPh3gAsnWIxHGZWzD8YhDTQ3kD4WOnY0XbMx7Zjb3 A==; X-CSE-ConnectionGUID: yEeQvvTOQEWAL8GoVC8qMg== X-CSE-MsgGUID: EOxx/Z3RR1WfgTM+xEPTIw== X-IronPort-AV: E=McAfee;i="6800,10657,11948"; a="1842031" X-IronPort-AV: E=Sophos;i="6.27,181,1787036400"; d="scan'208";a="1842031" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2026 15:49:07 -0700 X-CSE-ConnectionGUID: 1dGC000WSMWN/CMPuwqjow== X-CSE-MsgGUID: oVK737AIRtiIekmBbbJtqg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,181,1787036400"; d="scan'208";a="5056294" Received: from gsse-cloud1.jf.intel.com ([10.54.39.91]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Oct 2026 15:49:07 -0700 From: Matthew Brost To: intel-xe@lists.freedesktop.org, dri-devel@lists.freedesktop.org Subject: [PATCH v6 1/3] drm/xe: Bump the LRU on a successful page fault Date: Tue, 27 Oct 2026 15:49:00 -0700 Message-Id: <20261027224902.1085762-2-matthew.brost@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261027224902.1085762-1-matthew.brost@intel.com> References: <20261027224902.1085762-1-matthew.brost@intel.com> X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-19.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, T_SPF_TEMPERROR,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Servicing a page fault validates the VMA's backing store and binds it, making the BO part of the VM's active working set, but unlike exec it never moves anything on the TTM LRU. In fault mode, where a VM may run for a long time without a single exec, the BOs the GPU actually touches therefore drift towards the LRU head and are picked by eviction and by the shrinker ahead of genuinely cold BOs. Bump the BO's LRU on a successful page fault. Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") Signed-off-by: Matthew Brost --- drivers/gpu/drm/xe/xe_pagefault.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_pagefault.c b/drivers/gpu/drm/xe/xe_pagefault.c index 5247321c805e..6828f81df50e 100644 --- a/drivers/gpu/drm/xe/xe_pagefault.c +++ b/drivers/gpu/drm/xe/xe_pagefault.c @@ -201,6 +201,8 @@ static int xe_pagefault_handle_vma(struct xe_gt *gt, struct xe_vma *vma, xe_validation_ctx_init(&ctx, &vm->xe->val, &exec, (struct xe_val_flags) {}); drm_exec_until_all_locked(&exec) { + struct xe_bo *bo = xe_vma_bo(vma); + err = xe_pagefault_begin(&exec, vma, tile->mem.vram, needs_vram == 1); drm_exec_retry_on_contention(&exec); @@ -221,6 +223,11 @@ static int xe_pagefault_handle_vma(struct xe_gt *gt, struct xe_vma *vma, xe_pagefault_set_error(pf, XE_PAGEFAULT_ERROR_VMA_REBIND); break; } + + if (bo) { + scoped_guard(spinlock, &vm->xe->ttm.lru_lock) + ttm_bo_move_to_lru_tail(&bo->ttm); + } } xe_validation_ctx_fini(&ctx); } while (err == -EAGAIN); -- 2.34.1