Skip to contentSkip to conversation

drm/ttm: Account for kernel allocations in kernel zone only

PATCH In review Kuehling, Felix 5 participants 5 messages Feb 22, 2019 – Feb 26, 2019 3 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/ttm: Account for kernel allocations in kernel zone only

Don't account for them in other zones such as dma32. The kernel page allocator has its own heuristics to avoid exhausting special zones for regular kernel allocations.

---
 drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_memory.c +3 -3
index f1567c3..90d1e24 100644
@@ -522,7 +522,7 @@ static void ttm_mem_global_free_zone(struct ttm_mem_global *glob,
 void ttm_mem_global_free(struct ttm_mem_global *glob,
 			 uint64_t amount)
 {
-	return ttm_mem_global_free_zone(glob, NULL, amount);
+	return ttm_mem_global_free_zone(glob, glob->zone_kernel, amount);
 }
 EXPORT_SYMBOL(ttm_mem_global_free);
 
@@ -621,10 +621,10 @@ int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
 {
 	/**
 	 * Normal allocations of kernel memory are registered in
-	 * all zones.
+	 * the kernel zone.
 	 */
 
-	return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
+	return ttm_mem_global_alloc_zone(glob, glob->zone_kernel, memory, ctx);
 }
 EXPORT_SYMBOL(ttm_mem_global_alloc);
 
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1550877522-15317-1-git-send-email-Felix.Kuehling-5C7GfCeVMHo@public.gmane.org

Reviewed-by Christian König
#2 lore raw

Am 23.02.19 um 00:19 schrieb Kuehling, Felix:

Quoted 7 lines

Don't account for them in other zones such as dma32. The kernel page allocator has its own heuristics to avoid exhausting special zones for regular kernel allocations.

Quoted 20 lines
---
  drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
index f1567c3..90d1e24 100644
@@ -522,7 +522,7 @@ static void ttm_mem_global_free_zone(struct ttm_mem_global *glob,
  void ttm_mem_global_free(struct ttm_mem_global *glob,
  			 uint64_t amount)
  {
-	return ttm_mem_global_free_zone(glob, NULL, amount);
+	return ttm_mem_global_free_zone(glob, glob->zone_kernel, amount);
  }
  EXPORT_SYMBOL(ttm_mem_global_free);
 
@@ -621,10 +621,10 @@ int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory,
  {
  	/**

drivers/gpu/drm/ttm/ttm_memory.c int ttm_mem_global_alloc(struct ttm_mem_global *glob, uint64_t memory, · line 630

Quoted 10 lines
drivers/gpu/drm/ttm/ttm_memory.c +2 -2
  	 * Normal allocations of kernel memory are registered in
-	 * all zones.
+	 * the kernel zone.
  	 */
 
-	return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
+	return ttm_mem_global_alloc_zone(glob, glob->zone_kernel, memory, ctx);
  }
  EXPORT_SYMBOL(ttm_mem_global_alloc);
 

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): a0f6aa85-ab0e-e809-5e05-98056b9c7185-5C7GfCeVMHo@public.gmane.org

#4 lore raw
Quoted 11 lines · Christian

Am 23.02.19 um 00:19 schrieb Kuehling, Felix:

Quoted 8 lines

Don't account for them in other zones such as dma32. The kernel page
allocator has its own heuristics to avoid exhausting special zones for regular kernel allocations.

Hmm,

So actually with this patch we theoretically still can exhaust the DMA32 zone by first performing kernel allocations that DO spare a number of DMA32 pages according to the kernel allocator heuristics, and then populate TTM buffers with DMA32 pages only.

However, since vmwgfx bo's don't request DMA32 pages, we're OK with this, and it's really up to Christian to decide. So:

Thanks,
Thomas

Quoted 30 lines
Quoted 30 lines
---
  drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
index f1567c3..90d1e24 100644
@@ -522,7 +522,7 @@ static void ttm_mem_global_free_zone(struct
 ttm_mem_global *glob,
  void ttm_mem_global_free(struct ttm_mem_global *glob,
  			 uint64_t amount)
  {
-	return ttm_mem_global_free_zone(glob, NULL, amount);
+	return ttm_mem_global_free_zone(glob, glob->zone_kernel,
 amount);
  }
  EXPORT_SYMBOL(ttm_mem_global_free);
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
@@ -621,10 +621,10 @@ int ttm_mem_global_alloc(struct
 ttm_mem_global *glob, uint64_t memory,
  {
  	/**
  	 * Normal allocations of kernel memory are registered in
-	 * all zones.
+	 * the kernel zone.
  	 */
 
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
-	return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
+	return ttm_mem_global_alloc_zone(glob, glob->zone_kernel,
 memory, ctx);
  }
  EXPORT_SYMBOL(ttm_mem_global_alloc);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): a2fcbc0155a7f1eea9a6df9669dc2de75315e937.camel-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org

#6 lore raw
Quoted 18 lines · Thomas Hellstrom
Quoted 10 lines · Christian

Am 23.02.19 um 00:19 schrieb Kuehling, Felix:

Quoted 8 lines

Don't account for them in other zones such as dma32. The kernel page
allocator has its own heuristics to avoid exhausting special zones for regular kernel allocations.

Hmm,

So actually with this patch we theoretically still can exhaust the DMA32 zone by first performing kernel allocations that DO spare a number of DMA32 pages according to the kernel allocator heuristics, and then populate TTM buffers with DMA32 pages only.

Quoted 4 lines

However, since vmwgfx bo's don't request DMA32 pages, we're OK with this, and it's really up to Christian to decide. So:

Thanks. What's the best branch to submit this to? My patches were based on amd-staging-drm-next.

Regards,
  Felix

Quoted 40 lines

Thanks,
Thomas

Quoted 29 lines
Quoted 29 lines
---
   drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
index f1567c3..90d1e24 100644
@@ -522,7 +522,7 @@ static void ttm_mem_global_free_zone(struct
 ttm_mem_global *glob,
   void ttm_mem_global_free(struct ttm_mem_global *glob,
   			 uint64_t amount)
   {
-	return ttm_mem_global_free_zone(glob, NULL, amount);
+	return ttm_mem_global_free_zone(glob, glob->zone_kernel,
 amount);
   }
   EXPORT_SYMBOL(ttm_mem_global_free);
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
@@ -621,10 +621,10 @@ int ttm_mem_global_alloc(struct
 ttm_mem_global *glob, uint64_t memory,
   {
   	/**
   	 * Normal allocations of kernel memory are registered in
-	 * all zones.
+	 * the kernel zone.
   	 */
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
-	return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
+	return ttm_mem_global_alloc_zone(glob, glob->zone_kernel,
 memory, ctx);
   }
   EXPORT_SYMBOL(ttm_mem_global_alloc);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw
Quoted 20 lines · Felix
Quoted 18 lines · Thomas Hellstrom
Quoted 10 lines · Christian

Am 23.02.19 um 00:19 schrieb Kuehling, Felix:

Quoted 8 lines

Don't account for them in other zones such as dma32. The kernel page
allocator has its own heuristics to avoid exhausting special zones for regular kernel allocations.

Hmm,

So actually with this patch we theoretically still can exhaust the DMA32 zone by first performing kernel allocations that DO spare a number of DMA32 pages according to the kernel allocator heuristics, and then populate TTM buffers with DMA32 pages only.

Quoted 7 lines
Quoted 4 lines

However, since vmwgfx bo's don't request DMA32 pages, we're OK with this, and it's really up to Christian to decide. So:

Thanks. What's the best branch to submit this to? My patches were based on amd-staging-drm-next.

amd-staging-drm-next is fine. It will flow into drm-next naturally from there.

Alex

Quoted 44 lines

Regards,
Felix

Quoted 40 lines

Thanks,
Thomas

Quoted 29 lines
Quoted 29 lines
---
   drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
   1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
index f1567c3..90d1e24 100644
@@ -522,7 +522,7 @@ static void ttm_mem_global_free_zone(struct
 ttm_mem_global *glob,
   void ttm_mem_global_free(struct ttm_mem_global *glob,
                     uint64_t amount)
   {
-   return ttm_mem_global_free_zone(glob, NULL, amount);
+   return ttm_mem_global_free_zone(glob, glob->zone_kernel,
 amount);
   }
   EXPORT_SYMBOL(ttm_mem_global_free);
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
@@ -621,10 +621,10 @@ int ttm_mem_global_alloc(struct
 ttm_mem_global *glob, uint64_t memory,
   {
    /**
     * Normal allocations of kernel memory are registered in
-    * all zones.
+    * the kernel zone.
     */
 
Quoted 10 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/gpu/drm/ttm/ttm_memory.c +1 -1
-   return ttm_mem_global_alloc_zone(glob, NULL, memory, ctx);
+   return ttm_mem_global_alloc_zone(glob, glob->zone_kernel,
 memory, ctx);
   }
   EXPORT_SYMBOL(ttm_mem_global_alloc);

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel