drm_pagemap_...late_ram_pfn(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ drm_pagemap_migrate_populate_ram_pfn πŸ’…

okay so bestie, this is a page straight out of the Kernel API Manual and honestly? it's giving "internal DRM pagemap lore" and i'm obsessed. sit down, grab a strawberry πŸ“, and let's get into it.


🌸 NAME 🌸

drm_pagemap_migrate_populate_ram_pfn β€” literally just populating RAM PFNs for a VM area. that's the whole vibe. no cap.


✨ SYNOPSIS ✨

int drm_pagemap_migrate_populate_ram_pfn (struct vm_area_struct *vas ,
struct page *fault_page , unsigned long npages , unsigned long *mpages ,
unsigned long *src_mpfn , unsigned long *mpfn , unsigned long addr );

like… look at all those arguments. main character energy fr fr 🫢


πŸŽ€ ARGUMENTS πŸŽ€

  • vas β€” pointer to the VM area structure, and yes bestie it can be NULL. that's not a typo, it's a lifestyle. πŸ’…
  • fault_page β€” the fault page. iconic. does exactly what it says on the tin.
  • npages β€” how many pages you wanna populate. the count. the number. the quantity.
  • mpages β€” how many pages to migrate. slightly different number, don't mix them up πŸ™ˆ
  • src_mpfn β€” the source array of migrate PFNs. the "where you came from" of it all.
  • mpfn β€” the array of migrate PFNs you're actually populating. the destination. the glow-up. ✨
  • addr β€” the start address for PFN allocation. where it all begins.

πŸ¦‹ DESCRIPTION πŸ¦‹

so what does this thing do? it populates the RAM migrate page frame numbers (PFNs) for the VM area structure you hand it. it allocates and locks pages in the VM area for RAM usage β€” like, it's out here doing both jobs, we love a multitasker πŸ‘‘

and here's the tea on how it picks an allocator:

  • if vas is non-NULL β†’ it uses alloc_page_vma for allocation
  • if vas is NULL β†’ it uses alloc_page for allocation

that's it. that's the branch. simple, clean, slay. 🌈


πŸ”₯ RETURN πŸ”₯

  • 0 on success πŸŽ‰
  • a negative error code on failure 😭 (classic)

πŸ’œ SEE ALSO πŸ’œ

okay this list is long but every single one of these is required reading, no skipping, i will know πŸ‘€

  • Kernel file ./drivers/gpu/drm/drm_pagemap.c Overview(9)
  • Migration(9)
  • struct drm_pagemap_zdd(9)
  • drm_pagemap_zdd_alloc(9)
  • drm_pagemap_zdd_get(9)
  • drm_pagemap_zdd_destroy(9)
  • drm_pagemap_zdd_put(9)
  • drm_pagemap_migration_unlock_put_folio(9)
  • drm_pagemap_migration_unlock_put_pages(9)
  • drm_pagemap_get_devmem_page(9)
  • drm_pagemap_migrate_map_device_private_pages(9)
  • struct drm_pagemap_iova_state(9)
  • drm_pagemap_migrate_map_system_pages(9)
  • drm_pagemap_migrate_populate_src_pages(9)
  • drm_pagemap_migrate_unmap_pages(9)
  • struct migrate_range_loc(9)
  • drm_pagemap_cpages(9)
  • drm_pagemap_migrate_to_devmem(9)
  • struct drm_pagemap_dev_hold(9)
  • drm_pagemap_reinit(9)
  • drm_pagemap_init(9)
  • drm_pagemap_put(9)
  • drm_pagemap_page_get_flags(9)
  • drm_pagemap_page_set_flags(9)
  • drm_pagemap_retire_migrated_pages(9)
  • drm_pagemap_skip_retired_pages(9)
  • drm_pagemap_evict_to_ram(9)
  • __drm_pagemap_migrate_to_ram(9)
  • drm_pagemap_folio_free(9)
  • drm_pagemap_migrate_to_ram(9)
  • drm_pagemap_pagemap_ops_get(9)
  • drm_pagemap_devmem_init(9)
  • drm_pagemap_page_to_dpagemap(9)
  • drm_pagemap_populate_mm(9)

bestie warning 🚨 β€” the synopsis and every name above are literal. if you retype them, retype them exactly. no renaming, no "fixing", no merging. the kernel does not accept vibes-based spelling. πŸ’€

and that's the page!! tysm for reading, you ate that πŸ“βœ¨ this gem dropped from ./drivers/gpu/drm back in October 2026 β€” go forth and populate those PFNs, i'm rooting for you πŸ«ΆπŸ’–πŸŽ€

πŸ“¦ where this page comes from