Commit 3a5a0655 authored by Balbir Singh's avatar Balbir Singh Committed by Andrew Morton
Browse files

mm/zone_device: rename page_free callback to folio_free

Change page_free to folio_free to make the folio support for
zone device-private more consistent. The PCI P2PDMA callback
has also been updated and changed to folio_free() as a result.

For drivers that do not support folios (yet), the folio is
converted back into page via &folio->page and the page is used
as is, in the current callback implementation.

Link: https://lkml.kernel.org/r/20251001065707.920170-3-balbirs@nvidia.com


Signed-off-by: default avatarBalbir Singh <balbirs@nvidia.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Zi Yan <ziy@nvidia.com>
Cc: Joshua Hahn <joshua.hahnjy@gmail.com>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Byungchul Park <byungchul@sk.com>
Cc: Gregory Price <gourry@gourry.net>
Cc: Ying Huang <ying.huang@linux.alibaba.com>
Cc: Alistair Popple <apopple@nvidia.com>
Cc: Oscar Salvador <osalvador@suse.de>
Cc: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: "Liam R. Howlett" <Liam.Howlett@oracle.com>
Cc: Nico Pache <npache@redhat.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Dev Jain <dev.jain@arm.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Lyude Paul <lyude@redhat.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: David Airlie <airlied@gmail.com>
Cc: Simona Vetter <simona@ffwll.ch>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Cc: Mika Penttilä <mpenttil@redhat.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Francois Dugast <francois.dugast@intel.com>
Cc: Madhavan Srinivasan <maddy@linux.ibm.com>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: Felix Kuehling <Felix.Kuehling@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent d245f9b4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -165,7 +165,7 @@ The users of `ZONE_DEVICE` are:
* pmem: Map platform persistent memory to be used as a direct-I/O target
  via DAX mappings.

* hmm: Extend `ZONE_DEVICE` with `->page_fault()` and `->page_free()`
* hmm: Extend `ZONE_DEVICE` with `->page_fault()` and `->folio_free()`
  event callbacks to allow a device-driver to coordinate memory management
  events related to device-memory, typically GPU memory. See
  Documentation/mm/hmm.rst.
+3 −2
Original line number Diff line number Diff line
@@ -1014,8 +1014,9 @@ static vm_fault_t kvmppc_uvmem_migrate_to_ram(struct vm_fault *vmf)
 * to a normal PFN during H_SVM_PAGE_OUT.
 * Gets called with kvm->arch.uvmem_lock held.
 */
static void kvmppc_uvmem_page_free(struct page *page)
static void kvmppc_uvmem_folio_free(struct folio *folio)
{
	struct page *page = &folio->page;
	unsigned long pfn = page_to_pfn(page) -
			(kvmppc_uvmem_pgmap.range.start >> PAGE_SHIFT);
	struct kvmppc_uvmem_page_pvt *pvt;
@@ -1034,7 +1035,7 @@ static void kvmppc_uvmem_page_free(struct page *page)
}

static const struct dev_pagemap_ops kvmppc_uvmem_ops = {
	.page_free = kvmppc_uvmem_page_free,
	.folio_free = kvmppc_uvmem_folio_free,
	.migrate_to_ram	= kvmppc_uvmem_migrate_to_ram,
};

+3 −2
Original line number Diff line number Diff line
@@ -568,8 +568,9 @@ svm_migrate_ram_to_vram(struct svm_range *prange, uint32_t best_loc,
	return r < 0 ? r : 0;
}

static void svm_migrate_page_free(struct page *page)
static void svm_migrate_folio_free(struct folio *folio)
{
	struct page *page = &folio->page;
	struct svm_range_bo *svm_bo = page->zone_device_data;

	if (svm_bo) {
@@ -1009,7 +1010,7 @@ static vm_fault_t svm_migrate_to_ram(struct vm_fault *vmf)
}

static const struct dev_pagemap_ops svm_migrate_pgmap_ops = {
	.page_free		= svm_migrate_page_free,
	.folio_free		= svm_migrate_folio_free,
	.migrate_to_ram		= svm_migrate_to_ram,
};

+5 −5
Original line number Diff line number Diff line
@@ -752,15 +752,15 @@ static int __drm_pagemap_migrate_to_ram(struct vm_area_struct *vas,
}

/**
 * drm_pagemap_page_free() - Put GPU SVM zone device data associated with a page
 * @page: Pointer to the page
 * drm_pagemap_folio_free() - Put GPU SVM zone device data associated with a folio
 * @folio: Pointer to the folio
 *
 * This function is a callback used to put the GPU SVM zone device data
 * associated with a page when it is being released.
 */
static void drm_pagemap_page_free(struct page *page)
static void drm_pagemap_folio_free(struct folio *folio)
{
	drm_pagemap_zdd_put(page->zone_device_data);
	drm_pagemap_zdd_put(folio->page.zone_device_data);
}

/**
@@ -788,7 +788,7 @@ static vm_fault_t drm_pagemap_migrate_to_ram(struct vm_fault *vmf)
}

static const struct dev_pagemap_ops drm_pagemap_pagemap_ops = {
	.page_free = drm_pagemap_page_free,
	.folio_free = drm_pagemap_folio_free,
	.migrate_to_ram = drm_pagemap_migrate_to_ram,
};

+3 −2
Original line number Diff line number Diff line
@@ -108,8 +108,9 @@ unsigned long nouveau_dmem_page_addr(struct page *page)
	return chunk->bo->offset + off;
}

static void nouveau_dmem_page_free(struct page *page)
static void nouveau_dmem_folio_free(struct folio *folio)
{
	struct page *page = &folio->page;
	struct nouveau_dmem_chunk *chunk = nouveau_page_to_chunk(page);
	struct nouveau_dmem *dmem = chunk->drm->dmem;

@@ -220,7 +221,7 @@ static vm_fault_t nouveau_dmem_migrate_to_ram(struct vm_fault *vmf)
}

static const struct dev_pagemap_ops nouveau_dmem_pagemap_ops = {
	.page_free		= nouveau_dmem_page_free,
	.folio_free		= nouveau_dmem_folio_free,
	.migrate_to_ram		= nouveau_dmem_migrate_to_ram,
};

Loading