dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Alex Goins <agoins@nvidia.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: John Hubbard <jhubbard@nvidia.com>,
	dri-devel@lists.freedesktop.org, linux-mm@kvack.org,
	amd-gfx@lists.freedesktop.org, Zi Yan <ziy@nvidia.com>
Subject: [PATCH RFC 1/1] drm-ttm: Allocate transparent huge pages without clearing __GFP_COMP
Date: Wed, 30 Sep 2020 17:18:21 -0500	[thread overview]
Message-ID: <20200930221821.13719-2-agoins@nvidia.com> (raw)
In-Reply-To: <20200930221821.13719-1-agoins@nvidia.com>

TTM currently supports allocating pages with GFP_TRANSHUGE_LIGHT, but with
the __GFP_COMP flag cleared. Instead of being normal transparent huge
pages, these are multiorder non-compound pages that have the same order as
THPs. This interferes with drivers that import DMA-BUFs / SGTs backed by
pages from TTM, as they don't have the TTM-specific context to know how the
pages were allocated.

Change the TTM allocator so that it no longer clears the __GFP_COMP flag
when allocating THPs.

Signed-off-by: Alex Goins <agoins@nvidia.com>
---
 drivers/gpu/drm/ttm/ttm_page_alloc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_page_alloc.c b/drivers/gpu/drm/ttm/ttm_page_alloc.c
index 5c8883d7f74a..e72789184398 100644
--- a/drivers/gpu/drm/ttm/ttm_page_alloc.c
+++ b/drivers/gpu/drm/ttm/ttm_page_alloc.c
@@ -920,7 +920,6 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags,
 				huge_flags |= GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
 					__GFP_KSWAPD_RECLAIM;
 				huge_flags &= ~__GFP_MOVABLE;
-				huge_flags &= ~__GFP_COMP;
 				p = alloc_pages(huge_flags, HPAGE_PMD_ORDER);
 				if (!p)
 					break;
@@ -1057,13 +1056,13 @@ int ttm_page_alloc_init(struct ttm_mem_global *glob, unsigned max_pages)
 	ttm_page_pool_init_locked(&_manager->wc_pool_huge,
 				  (GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
 				   __GFP_KSWAPD_RECLAIM) &
-				  ~(__GFP_MOVABLE | __GFP_COMP),
+				  ~(__GFP_MOVABLE),
 				  "wc huge", order);
 
 	ttm_page_pool_init_locked(&_manager->uc_pool_huge,
 				  (GFP_TRANSHUGE_LIGHT | __GFP_NORETRY |
 				   __GFP_KSWAPD_RECLAIM) &
-				  ~(__GFP_MOVABLE | __GFP_COMP)
+				  ~(__GFP_MOVABLE)
 				  , "uc huge", order);
 
 	_manager->options.max_size = max_pages;
-- 
2.25.1

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

  reply	other threads:[~2020-09-30 22:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 22:18 [PATCH RFC 0/1] drm/ttm: Allocate transparent huge pages without clearing __GFP_COMP Alex Goins
2020-09-30 22:18 ` Alex Goins [this message]
2020-10-01  7:19 ` Christian König
2020-10-01 18:45   ` Alex Goins
2020-10-02  6:41     ` Christian König
2020-10-02  7:31       ` Daniel Vetter

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=20200930221821.13719-2-agoins@nvidia.com \
    --to=agoins@nvidia.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jhubbard@nvidia.com \
    --cc=linux-mm@kvack.org \
    --cc=ziy@nvidia.com \
    /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;
as well as URLs for NNTP newsgroup(s).