One confusion about PTE modification on page migration

frank kang frank.kanchy at
Mon Nov 4 04:56:07 EST 2013

Hello all,

I think i clear up the confusion myself, and would like to share to you.
For the above case, It's OK it will go to do_anonymous_page(...).
In do_anonymous_page, it will try to get the pte lock, but the pte lock is
already hold by migration routine.
So it will release new-allocated page and let the page fault to fail. I
think it will trigger a-retry for page fault.
That solves my doubt.

Thanks to all of you!


On Mon, Nov 4, 2013 at 4:45 PM, frank kang <frank.kanchy at> wrote:

> Hello all,
> I have one confusion about PTE modification on page migration. Can anyone
> help me clarify it?
> As we know, if process access the virtual addresss with null PTE entry, it
> will result in page fault. In page fault routine, it will check PTE entry
> to determine whether it is swap case, (handle_pte_fault)
> if (pte_none(entry)) {
> ....
> return do_anonymous_page(...);
> }
> return do_swap_page(...);
> But, in try_to_unmap_one_anon(...), the pte entry is cleared before it has
> new swap entry.
> pteval = ptep_clear_flush_notify(vma, address, pte);
> ...
> set_pte_at(mm, address, pte, swp_entry_to_pte(entry));
> I feel confused about the above atomic operation. That is, If the pte is
> zeroed and new swap entry is not set yet. Some process accesses to the
> address and page fault is raised.  In the above routine from page fault,
> pte_none() will return TRUE and it will go to do_anonymous_page(...),
> instead of do_swap_page(...).
> Am i right? I don't know if it is my fault or not.
> Can someone help me?
> Thanks!
> Frank
-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Kernelnewbies mailing list