Re: [PATCH][0/8] (Targeting 2.6.17) Posix memory locking and balanced mlock-LRU semantic

From: Stone Wang
Date: Tue Mar 21 2006 - 10:17:33 EST


Checked, mlocked pages dont take part in swapping-writeback,
unlike normal mmaped pages :

linux-2.6.16/mm/rmap.c

try_to_unmap_one()

603 if ((vma->vm_flags & VM_LOCKED) ||
604 (ptep_clear_flush_young(vma, address, pte)
605 && !ignore_refs)) {
606 ret = SWAP_FAIL;
607 goto out_unmap;
608 }
609
610 /* Nuke the page table entry. */
611 flush_cache_page(vma, address, page_to_pfn(page));
612 pteval = ptep_clear_flush(vma, address, pte);
613
614 /* Move the dirty bit to the physical page now the pte is gone. */
615 if (pte_dirty(pteval))
616 set_page_dirty(page);

For VM_LOCKED page, it goes back(line 607) without set_page_dirty(line 616).



2006/3/20, Christoph Lameter <clameter@xxxxxxx>:
> On Mon, 20 Mar 2006, Stone Wang wrote:
>
> > 2. More consistent LRU semantics in Memory Management.
> > Mlocked pages is placed on a separate LRU list: Wired List.
> > The pages dont take part in LRU algorithms,for they could never be swapped,
> > until munlocked.
>
> This also implies that dirty bits of the pte for mlocked pages are never
> checked.
>
> Currently light swapping (which is very common) will scan over all pages
> and move the dirty bits from the pte into struct page. This may take
> awhile but at least at some point we will write out dirtied pages.
>
> The result of not scanning mlocked pages will be that mmapped files will
> not be updated unless either the process terminates or msync() is called.
>
>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/