dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: "Michel Dänzer" <michel@daenzer.net>, Hongbo.He@amd.com
Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/ttm: swap consecutive allocated cached pages
Date: Mon, 4 Dec 2017 13:13:35 +0100	[thread overview]
Message-ID: <133b2274-927e-231f-0887-a9113f4bf7fe@gmail.com> (raw)
In-Reply-To: <53e107e3-533a-eb68-26cc-9a764281eb56@daenzer.net>

Am 04.12.2017 um 12:51 schrieb Michel Dänzer:
> On 2017-12-04 12:42 PM, Christian König wrote:
>> When we detect consecutive allocation of pages swap them to avoid
>> accidentally freeing them as huge page.
>>
>> Signed-off-by: Christian König <christian.koenig@amd.com>
>> ---
>>   drivers/gpu/drm/ttm/ttm_page_alloc.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
>> index c82d94cbbabc..60401350a01a 100644
>> --- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
>> +++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
>> @@ -921,6 +921,14 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags,
>>   				return -ENOMEM;
>>   			}
>>   
>> +			/* Swap the pages if we detect consecutive order */
>> +			if (i && pages[i - 1] == p - 1) {
>> +				struct page *tmp = p;
>> +
>> +				p = pages[i - 1];
>> +				pages[i - 1] = tmp;
>> +			}
>> +
> Should be (something like):
>
> 		if (i && pages[i - 1] == p - 1)
> 			swap(pages[i - 1], p);

Good point, updates patches send out a few seconds ago.

Please review,
Christian.
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2017-12-04 12:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-04 11:42 [PATCH 1/2] drm/ttm: swap consecutive allocated cached pages Christian König
     [not found] ` <20171204114224.27712-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2017-12-04 11:42   ` [PATCH 2/2] drm/ttm: swap consecutive allocated pooled pages Christian König
2017-12-04 11:51 ` [PATCH 1/2] drm/ttm: swap consecutive allocated cached pages Michel Dänzer
2017-12-04 12:13   ` Christian König [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=133b2274-927e-231f-0887-a9113f4bf7fe@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=Hongbo.He@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=michel@daenzer.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox