CACHE LOOKUP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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:

mwah πŸ’‹ this lil page comes from ./drivers/gpu/drm, dated October 2026 β€” catch u later, bestie 🫢✨

πŸ“¦ where this page comes from