History

mm: make mm->pinned_vm an atomic64 counter

Taking a sleeping lock to _only_ increment a variable is quite the overkill, and pretty much all users do this. Furthermore, some drivers (ie: infiniband and scif) that need pinned semantics can go to quite some trouble to actually delay via workqueue (un)accounting for pinned pages when not possible to acquire it. By making the counter atomic we no longer need to hold the mmap_sem and can simply some code around it for pinned_vm users. The counter is 64-bit such that we need not worry about overflows such as rdma user input controlled from userspace.

Davidlohr Bueso committed 7 years ago

Commit 70f8a3c1 parent a2bfd7010 files · +28 −27Browse files

Showing the changes to include/linux (1 of 10 files). Show all

Unified · Split

include/linux/mm_types.h+1−1
@@ -405,7 +405,7 @@ struct mm_struct { · 404 unmodified lines
405405
406406 unsigned long total_vm; /* Total pages mapped */
407407 unsigned long locked_vm; /* Pages that have PG_mlocked set */
408− unsigned long pinned_vm; /* Refcount permanently increased */
408+ atomic64_t pinned_vm; /* Refcount permanently increased */
409409 unsigned long data_vm; /* VM_WRITE & ~VM_SHARED & ~VM_STACK */
410410 unsigned long exec_vm; /* VM_EXEC & ~VM_WRITE & ~VM_STACK */
411411 unsigned long stack_vm; /* VM_STACK */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t