All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: increase ttm pre-fault value to PMD size
@ 2024-05-30  3:41 Zhu Lingshan
  2024-05-30  4:02 ` Huang Rui
  0 siblings, 1 reply; 3+ messages in thread
From: Zhu Lingshan @ 2024-05-30  3:41 UTC (permalink / raw)
  To: ray.huang, christian.koenig; +Cc: dri-devel, Zhu 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.

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.

Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>
---
 include/drm/ttm/ttm_bo.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
index 6ccf96c91f3a..c20ef44002da 100644
--- a/include/drm/ttm/ttm_bo.h
+++ b/include/drm/ttm/ttm_bo.h
@@ -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;
 
-- 
2.45.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/ttm: increase ttm pre-fault value to PMD size
  2024-05-30  3:41 [PATCH] drm/ttm: increase ttm pre-fault value to PMD size Zhu Lingshan
@ 2024-05-30  4:02 ` Huang Rui
  2024-05-30  7:51   ` Zhu Lingshan
  0 siblings, 1 reply; 3+ messages in thread
From: Huang Rui @ 2024-05-30  4:02 UTC (permalink / raw)
  To: Zhu, Lingshan
  Cc: Koenig, Christian, dri-devel@lists.freedesktop.org, Jingxiang Li

On Thu, May 30, 2024 at 11:41:04AM +0800, Zhu, Lingshan wrote:
> 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.
> 
> Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>

Thanks Lingshan.

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

Reported-by: Jingxiang Li <jingxiang.li@ecarxgroup.com>

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

Thanks,
Ray

> ---
>  include/drm/ttm/ttm_bo.h | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
> index 6ccf96c91f3a..c20ef44002da 100644
> --- a/include/drm/ttm/ttm_bo.h
> +++ b/include/drm/ttm/ttm_bo.h
> @@ -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;
>  
> -- 
> 2.45.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/ttm: increase ttm pre-fault value to PMD size
  2024-05-30  4:02 ` Huang Rui
@ 2024-05-30  7:51   ` Zhu Lingshan
  0 siblings, 0 replies; 3+ messages in thread
From: Zhu Lingshan @ 2024-05-30  7:51 UTC (permalink / raw)
  To: Huang Rui
  Cc: Koenig, Christian, dri-devel@lists.freedesktop.org, Jingxiang Li

Please ignore this patch, V2 will be send out soon

Thanks
Zhu Lingshan

On 5/30/2024 12:02 PM, Huang Rui wrote:
> On Thu, May 30, 2024 at 11:41:04AM +0800, Zhu, Lingshan wrote:
>> 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.
>>
>> Signed-off-by: Zhu Lingshan <lingshan.zhu@amd.com>
> Thanks Lingshan.
>
> I suggested to add reported-by from Jiangxiang like that:
>
> Reported-by: Jingxiang Li <jingxiang.li@ecarxgroup.com>
>
> Jingxiang, could you please test this patch? We expect to have a Tested-by. :-)
>
> Thanks,
> Ray
>
>> ---
>>  include/drm/ttm/ttm_bo.h | 6 +++++-
>>  1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/drm/ttm/ttm_bo.h b/include/drm/ttm/ttm_bo.h
>> index 6ccf96c91f3a..c20ef44002da 100644
>> --- a/include/drm/ttm/ttm_bo.h
>> +++ b/include/drm/ttm/ttm_bo.h
>> @@ -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;
>>  
>> -- 
>> 2.45.1
>>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-05-30  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-30  3:41 [PATCH] drm/ttm: increase ttm pre-fault value to PMD size Zhu Lingshan
2024-05-30  4:02 ` Huang Rui
2024-05-30  7:51   ` Zhu Lingshan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.