This mechanism can never reduce the counter value to less than 1 this means that the associated page is not freed This is because of the additional usage counter increment required to ensure correct handling of the CPU cache as discussed above

The flush_all_zero_pkmaps also mentioned above is key to the final freeing of a mapping; it is always invoked when the search for a free position in map_new_virtual starts from the beginning. It is responsible for three actions:

1. flush_cache_kmaps performs a flush on the kernel mappings (on most architectures that require explicit flushing, the complete CPU cache is flushed using flush_cache_all) because the global page tables of the kernel are changed.25

25This is a very costly operation that fortunately is not required on many processor architectures. In this case, it is defined as a null operation as described in Section 3.7.

2. pkmap_count is scanned in full. Entries with counter value 1 are set to 0, and the associated entry is deleted from the page table, thus finally removing the mapping.

3. Finally, all TLB entries present for the pkmap area are flushed using the flush_tlb_kernel_ range function.

Continue reading here: Temporary Kernel Mappings

Was this article helpful?

0 0