Skip to contentSkip to conversation

drm/ttm: increase ttm pre-fault value to PMD size

PATCH Superseded Zhu Lingshan 2 participants 3 messages May 30, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: increase ttm pre-fault value to PMD size

ttm page fault handler ttm_bo_vm_fault_reserved() maps TTM_BO_VM_NUM_PREFAULT more pages beforehand due to the principle of locality.

However, on some platform the page faults are more costly, this patch intends to increase the number of ttm pre-fault to relieve the number of page faults.

When multiple levels of page table is supported, the new default value would be the PMD size, similar to huge page.

---
 include/drm/ttm/ttm_bo.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/drm/ttm/ttm_bo.h +5 -1
index 6ccf96c91f3a..c20ef44002da 100644
@@ -39,7 +39,11 @@
 #include "ttm_device.h"
 
 /* Default number of pre-faulted pages in the TTM fault handler */
-#define TTM_BO_VM_NUM_PREFAULT 16
+#ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES
+#define TTM_BO_VM_NUM_PREFAULT (1 << (PMD_SHIFT - PAGE_SHIFT))
+#else
+ #define TTM_BO_VM_NUM_PREFAULT 16
+#endif
 
 struct iosys_map;
 
Signature · 1 line
2.45.1
#1 lore raw
Quoted 4 lines · Lingshan

ttm page fault handler ttm_bo_vm_fault_reserved() maps TTM_BO_VM_NUM_PREFAULT more pages beforehand due to the principle of locality.

Quoted 8 lines

However, on some platform the page faults are more costly, this patch intends to increase the number of ttm pre-fault to relieve the number of page faults.

When multiple levels of page table is supported, the new default value would be the PMD size, similar to huge page.

Thanks Lingshan.

I suggested to add reported-by from Jiangxiang like that:

Jingxiang, could you please test this patch? We expect to have a Tested-by. :-)

Thanks,
Ray

Quoted 24 lines
---
 include/drm/ttm/ttm_bo.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/drm/ttm/ttm_bo.h +5 -1
index 6ccf96c91f3a..c20ef44002da 100644
@@ -39,7 +39,11 @@
 #include "ttm_device.h"
 
 /* Default number of pre-faulted pages in the TTM fault handler */
-#define TTM_BO_VM_NUM_PREFAULT 16
+#ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES
+#define TTM_BO_VM_NUM_PREFAULT (1 << (PMD_SHIFT - PAGE_SHIFT))
+#else
+ #define TTM_BO_VM_NUM_PREFAULT 16
+#endif
 
 struct iosys_map;
 
Signature · 1 line
2.45.1
#2 lore raw

Please ignore this patch, V2 will be send out soon

Thanks
Zhu Lingshan

Quoted 48 lines · Huang Rui
Quoted 4 lines · Lingshan

ttm page fault handler ttm_bo_vm_fault_reserved() maps TTM_BO_VM_NUM_PREFAULT more pages beforehand due to the principle of locality.

Quoted 8 lines

However, on some platform the page faults are more costly, this patch intends to increase the number of ttm pre-fault to relieve the number of page faults.

When multiple levels of page table is supported, the new default value would be the PMD size, similar to huge page.

Thanks Lingshan.

I suggested to add reported-by from Jiangxiang like that:

Jingxiang, could you please test this patch? We expect to have a Tested-by. :-)

Thanks,
Ray

Quoted 24 lines
---
 include/drm/ttm/ttm_bo.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
include/drm/ttm/ttm_bo.h +5 -1
index 6ccf96c91f3a..c20ef44002da 100644
@@ -39,7 +39,11 @@
 #include "ttm_device.h"
 
 /* Default number of pre-faulted pages in the TTM fault handler */
-#define TTM_BO_VM_NUM_PREFAULT 16
+#ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES
+#define TTM_BO_VM_NUM_PREFAULT (1 << (PMD_SHIFT - PAGE_SHIFT))
+#else
+ #define TTM_BO_VM_NUM_PREFAULT 16
+#endif
 
 struct iosys_map;
 
Signature · 1 line
2.45.1