DEV Community

heygauri
heygauri

Posted on • Edited on

2

Outreachy series: “Think about your audience”

Linux Kernel Image

Hello readers! I am currently in my fifth week of the Outreachy internship, where I am working as a Linux-Kernel intern on the project "Converting kmap() and kmap_atomic() call sites to kmap_local_page()".

This blog aims to introduce you to my project and the significance of memory management in modern operating systems.

As part of the Memory Management system's Highmem subsystem, changes are being made to replace the older kmap() and kmap_atomic() functions with the new kmap_local_page() or kmap_local_folio() functions. These functions allow the mapping of physical memory pages into the kernel address space.

The deprecation of kmap() and kmap_atomic() is due to their drawbacks, such as high cost, limited mapping space, the need for a global lock for synchronization, and the possibility of the process sleeping in the absence of free slots. Similarly, kmap_atomic() disables preemption and migration, which can lead to latency, jitters, and system imbalance.

To overcome these issues, the solution lies in using kmap_local_{page, folio}(). These functions offer faster performance, provide thread-local and CPU-local mappings, handle page faults within a local kmap region, and preserve preemption by saving and restoring mappings during context switches.

For more detailed information, you can refer to the documentation available at https://docs.kernel.org/mm/highmem.html.

In my work, I am evaluating various call sites to determine how effectively kmap_local() can be utilized and the deprecated kmap() and kmap_atomic() calls can be eliminated. While some conversions simply involve replacement, others require thorough code analysis and potentially even rearchitecting of the codebase.

NEXT: Conversion from kmap() to kmap_local_page() https://dev.to/heygauri/conversion-from-kmap-to-kmaplocalpage-2hc8

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay