Hi, Thanks for replying.
You are right, I have to dig into the down_read implementation in kernel. I know about the reader-writer lock semantics, but I was looking if someone has more insights on the down_read kernel implementation.
The reason behind "trying to retrying" is slightly complicated. It's a research problem. To simplify, a group of physical pages are mapped to kernel virtual address, and the pages may be later mapped and shared by different processes. While doing certain operation on the group of pages, I write protect those pages mapped by all the processes and follow with some pointer manipulations in the kernel. I need to make sure no change happens to the pages until I am done with what I need to do
. One way to achieve this would be to down_write all the mmap_sem for all the processes; the other way would be retrying the page faults.
Appreciate your suggestions.