CACHE LOOKUP(9)
Bestie, this is the Cache lookup(9) page from the Kernel API Manual β welcome to the chat where we keep the facts and add the sparkle. β¨ No cap.
πΈ CACHE LOOKUP πΈ
Okay so cache lookup should be done under a locked mutex, so that a failed drm_pagemap_get_from_cache and a following drm_pagemap_cache_setpagemap are carried out as an atomic operation WRT other lookups. And why? Because otherwise, racing lookups may unnecessarily concurrently create pagemaps to fulfill a failed lookup. π
The API provides two functions to perform this lock, drm_pagemap_lock_lookup and drm_pagemap_unlock_lookup, and they should be used in the following way: π
drm_pagemap_lock_lookup(cache);
dpagemap = drm_pagemap_get_from_cache(cache);
if (dpagemap)
goto out_unlock;
dpagemap = driver_create_new_dpagemap;
if (!IS_ERR(dpagemap))
drm_pagemap_cache_set_pagemap(cache, dpagemap);
out_unlock:
drm_pagemap_unlock_lookup(cache);
π¦ SEE ALSO π¦
Kernel file: ./drivers/gpu/drm/drm_pagemap_util.c β and the whole squad is here:
struct drm_pagemap_cache(9)struct drm_pagemap_shrinker(9)drm_pagemap_cache_create_devm(9)drm_pagemap_cache_lock_lookup(9)drm_pagemap_cache_unlock_lookup(9)drm_pagemap_get_from_cache(9)drm_pagemap_cache_set_pagemap(9)drm_pagemap_get_from_cache_if_active(9)drm_pagemap_shrinker_might_lock(9)drm_pagemap_shrinker_add(9)drm_pagemap_shrinker_create_devm(9)struct drm_pagemap_owner(9)drm_pagemap_release_owner(9)interconnect_fn(9)drm_pagemap_acquire_owner(9)
mwah π this lil page comes from ./drivers/gpu/drm, dated October 2026 β catch u later, bestie π«Άβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms