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

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

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay