diff mbox series

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

Message ID 1550877522-15317-1-git-send-email-Felix.Kuehling@amd.com (mailing list archive)
State New, archived
Headers show
Series [1/1] drm/ttm: Account for kernel allocations in kernel zone only | expand

Commit Message

Felix Kuehling Feb. 22, 2019, 11:19 p.m. UTC
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.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
CC: thellstrom@vmware.com
CC: christian.koenig@amd.com
---
 drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Christian König Feb. 25, 2019, 2:20 p.m. UTC | #1
Am 23.02.19 um 00:19 schrieb Kuehling, Felix:
> 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.
>
> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> CC: thellstrom@vmware.com
> CC: christian.koenig@amd.com

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
> index f1567c3..90d1e24 100644
> --- a/drivers/gpu/drm/ttm/ttm_memory.c
> +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> @@ -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);
>
Thomas Hellstrom Feb. 25, 2019, 7:58 p.m. UTC | #2
On Mon, 2019-02-25 at 14:20 +0000, Koenig, Christian wrote:
> Am 23.02.19 um 00:19 schrieb Kuehling, Felix:
> > 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.
> > 
> > Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> > CC: thellstrom@vmware.com
> > CC: christian.koenig@amd.com
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>

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:

Acked-by: Thomas Hellstrom <thellstrom@vmware.com>

Thanks,
Thomas








> 
> > ---
> >   drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
> >   1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/ttm/ttm_memory.c
> > b/drivers/gpu/drm/ttm/ttm_memory.c
> > index f1567c3..90d1e24 100644
> > --- a/drivers/gpu/drm/ttm/ttm_memory.c
> > +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> > @@ -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);
> >
Felix Kuehling Feb. 26, 2019, 4:25 a.m. UTC | #3
On 2/25/2019 2:58 PM, Thomas Hellstrom wrote:
> On Mon, 2019-02-25 at 14:20 +0000, Koenig, Christian wrote:
>> Am 23.02.19 um 00:19 schrieb Kuehling, Felix:
>>> 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.
>>>
>>> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
>>> CC: thellstrom@vmware.com
>>> CC: christian.koenig@amd.com
>> Reviewed-by: Christian König <christian.koenig@amd.com>
> 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:
>
> Acked-by: Thomas Hellstrom <thellstrom@vmware.com>

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

Regards,
   Felix

>
> Thanks,
> Thomas
>
>
>
>
>
>
>
>
>>> ---
>>>    drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
>>>    1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/ttm/ttm_memory.c
>>> b/drivers/gpu/drm/ttm/ttm_memory.c
>>> index f1567c3..90d1e24 100644
>>> --- a/drivers/gpu/drm/ttm/ttm_memory.c
>>> +++ b/drivers/gpu/drm/ttm/ttm_memory.c
>>> @@ -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);
>>>
Alex Deucher Feb. 26, 2019, 5:37 a.m. UTC | #4
On Mon, Feb 25, 2019 at 11:25 PM Kuehling, Felix <Felix.Kuehling@amd.com> wrote:
>
> On 2/25/2019 2:58 PM, Thomas Hellstrom wrote:
> > On Mon, 2019-02-25 at 14:20 +0000, Koenig, Christian wrote:
> >> Am 23.02.19 um 00:19 schrieb Kuehling, Felix:
> >>> 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.
> >>>
> >>> Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
> >>> CC: thellstrom@vmware.com
> >>> CC: christian.koenig@amd.com
> >> Reviewed-by: Christian König <christian.koenig@amd.com>
> > 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:
> >
> > Acked-by: Thomas Hellstrom <thellstrom@vmware.com>
>
> 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

>
> Regards,
>    Felix
>
> >
> > Thanks,
> > Thomas
> >
> >
> >
> >
> >
> >
> >
> >
> >>> ---
> >>>    drivers/gpu/drm/ttm/ttm_memory.c | 6 +++---
> >>>    1 file changed, 3 insertions(+), 3 deletions(-)
> >>>
> >>> diff --git a/drivers/gpu/drm/ttm/ttm_memory.c
> >>> b/drivers/gpu/drm/ttm/ttm_memory.c
> >>> index f1567c3..90d1e24 100644
> >>> --- a/drivers/gpu/drm/ttm/ttm_memory.c
> >>> +++ b/drivers/gpu/drm/ttm/ttm_memory.c
> >>> @@ -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);
> >>>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox series

Patch

diff --git a/drivers/gpu/drm/ttm/ttm_memory.c b/drivers/gpu/drm/ttm/ttm_memory.c
index f1567c3..90d1e24 100644
--- a/drivers/gpu/drm/ttm/ttm_memory.c
+++ b/drivers/gpu/drm/ttm/ttm_memory.c
@@ -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);