From: Matthew Brost <matthew.brost@intel.com>
To: Francois Dugast <francois.dugast@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 2/4] drm/pagemap: Unlock and put folios when possible
Date: Thu, 18 Dec 2025 13:59:10 -0800 [thread overview]
Message-ID: <aUR5LifU3Wk2BQ3G@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251216201206.1660899-3-francois.dugast@intel.com>
On Tue, Dec 16, 2025 at 09:10:12PM +0100, Francois Dugast wrote:
> If the page is part of a folio, unlock and put the whole folio at once
> instead of individual pages one after the other. This will reduce the
> amount of operations once device THP are in use.
>
> Suggested-by: Matthew Brost <matthew.brost@intel.com>
> Signed-off-by: Francois Dugast <francois.dugast@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/drm_pagemap.c | 26 +++++++++++++++++---------
> 1 file changed, 17 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_pagemap.c b/drivers/gpu/drm/drm_pagemap.c
> index 37d7cfbbb3e8..491de9275add 100644
> --- a/drivers/gpu/drm/drm_pagemap.c
> +++ b/drivers/gpu/drm/drm_pagemap.c
> @@ -149,15 +149,15 @@ static void drm_pagemap_zdd_put(struct drm_pagemap_zdd *zdd)
> }
>
> /**
> - * drm_pagemap_migration_unlock_put_page() - Put a migration page
> - * @page: Pointer to the page to put
> + * drm_pagemap_migration_unlock_put_folio() - Put a migration folio
> + * @folio: Pointer to the folio to put
> *
> - * This function unlocks and puts a page.
> + * This function unlocks and puts a folio.
> */
> -static void drm_pagemap_migration_unlock_put_page(struct page *page)
> +static void drm_pagemap_migration_unlock_put_folio(struct folio *folio)
> {
> - unlock_page(page);
> - put_page(page);
> + folio_unlock(folio);
> + folio_put(folio);
> }
>
> /**
> @@ -172,15 +172,23 @@ static void drm_pagemap_migration_unlock_put_pages(unsigned long npages,
> {
> unsigned long i;
>
> - for (i = 0; i < npages; ++i) {
> + for (i = 0; i < npages;) {
> struct page *page;
> + struct folio *folio;
> + unsigned int order = 0;
>
> if (!migrate_pfn[i])
> - continue;
> + goto next;
>
> page = migrate_pfn_to_page(migrate_pfn[i]);
> - drm_pagemap_migration_unlock_put_page(page);
> + folio = page_folio(page);
> + order = folio_order(folio);
> +
> + drm_pagemap_migration_unlock_put_folio(folio);
> migrate_pfn[i] = 0;
> +
> +next:
> + i += NR_PAGES(order);
> }
> }
>
> --
> 2.43.0
>
next prev parent reply other threads:[~2025-12-18 21:59 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-16 20:10 [PATCH 0/4] Enable THP support in drm_pagemap Francois Dugast
2025-12-16 20:10 ` [PATCH 1/4] mm/migrate: Add migrate_device_split_page Francois Dugast
2025-12-16 20:34 ` Matthew Wilcox
2025-12-16 21:39 ` Matthew Brost
2026-01-06 2:39 ` Matthew Brost
2026-01-07 20:15 ` Zi Yan
2026-01-07 20:20 ` Zi Yan
2026-01-07 20:38 ` Zi Yan
2026-01-07 21:15 ` Matthew Brost
2026-01-07 22:03 ` Zi Yan
2026-01-08 0:56 ` Balbir Singh
2026-01-08 2:17 ` Matthew Brost
2026-01-08 2:53 ` Zi Yan
2026-01-08 3:14 ` Alistair Popple
2026-01-08 3:42 ` Matthew Brost
2026-01-08 4:47 ` Balbir Singh
2025-12-16 20:10 ` [PATCH 2/4] drm/pagemap: Unlock and put folios when possible Francois Dugast
2025-12-18 21:59 ` Matthew Brost [this message]
2025-12-16 20:10 ` [PATCH 3/4] drm/pagemap: Add helper to access zone_device_data Francois Dugast
2025-12-18 22:19 ` Matthew Brost
2025-12-19 15:29 ` Francois Dugast
2025-12-19 20:13 ` Matthew Brost
2025-12-16 20:10 ` [PATCH 4/4] drm/pagemap: Enable THP support for GPU memory migration Francois Dugast
2025-12-18 22:24 ` Matthew Brost
2025-12-17 0:14 ` ✗ CI.checkpatch: warning for Enable THP support in drm_pagemap Patchwork
2025-12-17 0:16 ` ✓ CI.KUnit: success " Patchwork
2025-12-17 0:31 ` ✗ CI.checksparse: warning " Patchwork
2025-12-17 0:55 ` ✓ Xe.CI.BAT: success " Patchwork
2025-12-17 23:22 ` ✗ Xe.CI.Full: failure " Patchwork
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=aUR5LifU3Wk2BQ3G@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=francois.dugast@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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