Quote:
Originally Posted by pan64
I don't understand why should it increment refcount in case of a move.
|
What move_vma() actually does is
(1) create a new mapping at destination.
(2) copy old mapping from source to the new mapping created in (1).
(3) unmap old mapping.
But the code shows that it will decrement refcount of struct page at (3) but does not increment the refcount of struct page at (1) or (2). So after move_vma(), there is still a memory mapping (at destination) needs those pages but it has been cleaned in step (3).
So I wonder why kernel does not increment refcount of struct page in (1) or (2), so after the decrement in (3) the pages will not be freed.
Quote:
Originally Posted by pan64
This is definitely documented and explained. Otherwise I don't really understand this question, if a page is freed it is not in use and cannot be accessed by apps - if I understand well
|
So as I explained, the struct page has been freed in (3) and the physical memory page's content may disappear. If it is an anonymous and private pages, there is no place to find the memory content if user access it through the new mapping after calling sys_mremap().
Thanks for your reply and discussion!