projects
/
deliverable
/
linux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CGroup API files: use cgroup map for memcontrol stats file
[deliverable/linux.git]
/
mm
/
rmap.c
diff --git
a/mm/rmap.c
b/mm/rmap.c
index 4a3487921effd04b4ab3c3cdbddf216259366d10..bf0a5b7cfb8e7a97369271ed235a714bd11dfd12 100644
(file)
--- a/
mm/rmap.c
+++ b/
mm/rmap.c
@@
-302,7
+302,8
@@
out:
return referenced;
}
return referenced;
}
-static int page_referenced_anon(struct page *page)
+static int page_referenced_anon(struct page *page,
+ struct mem_cgroup *mem_cont)
{
unsigned int mapcount;
struct anon_vma *anon_vma;
{
unsigned int mapcount;
struct anon_vma *anon_vma;
@@
-315,6
+316,13
@@
static int page_referenced_anon(struct page *page)
mapcount = page_mapcount(page);
list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
mapcount = page_mapcount(page);
list_for_each_entry(vma, &anon_vma->head, anon_vma_node) {
+ /*
+ * If we are reclaiming on behalf of a cgroup, skip
+ * counting on behalf of references from different
+ * cgroups
+ */
+ if (mem_cont && !mm_match_cgroup(vma->vm_mm, mem_cont))
+ continue;
referenced += page_referenced_one(page, vma, &mapcount);
if (!mapcount)
break;
referenced += page_referenced_one(page, vma, &mapcount);
if (!mapcount)
break;
@@
-327,6
+335,7
@@
static int page_referenced_anon(struct page *page)
/**
* page_referenced_file - referenced check for object-based rmap
* @page: the page we're checking references on.
/**
* page_referenced_file - referenced check for object-based rmap
* @page: the page we're checking references on.
+ * @mem_cont: target memory controller
*
* For an object-based mapped page, find all the places it is mapped and
* check/clear the referenced flag. This is done by following the page->mapping
*
* For an object-based mapped page, find all the places it is mapped and
* check/clear the referenced flag. This is done by following the page->mapping
@@
-335,7
+344,8
@@
static int page_referenced_anon(struct page *page)
*
* This function is only called from page_referenced for object-based pages.
*/
*
* This function is only called from page_referenced for object-based pages.
*/
-static int page_referenced_file(struct page *page)
+static int page_referenced_file(struct page *page,
+ struct mem_cgroup *mem_cont)
{
unsigned int mapcount;
struct address_space *mapping = page->mapping;
{
unsigned int mapcount;
struct address_space *mapping = page->mapping;
@@
-368,6
+378,13
@@
static int page_referenced_file(struct page *page)
mapcount = page_mapcount(page);
vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
mapcount = page_mapcount(page);
vma_prio_tree_foreach(vma, &iter, &mapping->i_mmap, pgoff, pgoff) {
+ /*
+ * If we are reclaiming on behalf of a cgroup, skip
+ * counting on behalf of references from different
+ * cgroups
+ */
+ if (mem_cont && !mm_match_cgroup(vma->vm_mm, mem_cont))
+ continue;
if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE))
== (VM_LOCKED|VM_MAYSHARE)) {
referenced++;
if ((vma->vm_flags & (VM_LOCKED|VM_MAYSHARE))
== (VM_LOCKED|VM_MAYSHARE)) {
referenced++;
@@
-386,33
+403,37
@@
static int page_referenced_file(struct page *page)
* page_referenced - test if the page was referenced
* @page: the page to test
* @is_locked: caller holds lock on the page
* page_referenced - test if the page was referenced
* @page: the page to test
* @is_locked: caller holds lock on the page
+ * @mem_cont: target memory controller
*
* Quick test_and_clear_referenced for all mappings to a page,
* returns the number of ptes which referenced the page.
*/
*
* Quick test_and_clear_referenced for all mappings to a page,
* returns the number of ptes which referenced the page.
*/
-int page_referenced(struct page *page, int is_locked)
+int page_referenced(struct page *page, int is_locked,
+ struct mem_cgroup *mem_cont)
{
int referenced = 0;
{
int referenced = 0;
- if (page_test_and_clear_young(page))
- referenced++;
-
if (TestClearPageReferenced(page))
referenced++;
if (page_mapped(page) && page->mapping) {
if (PageAnon(page))
if (TestClearPageReferenced(page))
referenced++;
if (page_mapped(page) && page->mapping) {
if (PageAnon(page))
- referenced += page_referenced_anon(page);
+ referenced += page_referenced_anon(page
, mem_cont
);
else if (is_locked)
else if (is_locked)
- referenced += page_referenced_file(page);
+ referenced += page_referenced_file(page
, mem_cont
);
else if (TestSetPageLocked(page))
referenced++;
else {
if (page->mapping)
else if (TestSetPageLocked(page))
referenced++;
else {
if (page->mapping)
- referenced += page_referenced_file(page);
+ referenced +=
+ page_referenced_file(page, mem_cont);
unlock_page(page);
}
}
unlock_page(page);
}
}
+
+ if (page_test_and_clear_young(page))
+ referenced++;
+
return referenced;
}
return referenced;
}
@@
-488,7
+509,7
@@
int page_mkclean(struct page *page)
EXPORT_SYMBOL_GPL(page_mkclean);
/**
EXPORT_SYMBOL_GPL(page_mkclean);
/**
- * page_set_anon_rmap - setup new anonymous rmap
+ *
__
page_set_anon_rmap - setup new anonymous rmap
* @page: the page to add the mapping to
* @vma: the vm area in which the mapping is added
* @address: the user virtual address mapped
* @page: the page to add the mapping to
* @vma: the vm area in which the mapping is added
* @address: the user virtual address mapped
@@
-512,7
+533,7
@@
static void __page_set_anon_rmap(struct page *page,
}
/**
}
/**
- *
page_set
_anon_rmap - sanity check anonymous rmap addition
+ *
__page_check
_anon_rmap - sanity check anonymous rmap addition
* @page: the page to add the mapping to
* @vma: the vm area in which the mapping is added
* @address: the user virtual address mapped
* @page: the page to add the mapping to
* @vma: the vm area in which the mapping is added
* @address: the user virtual address mapped
@@
-565,7
+586,7
@@
void page_add_anon_rmap(struct page *page,
}
}
}
}
-/*
+/*
*
* page_add_new_anon_rmap - add pte mapping to a new anonymous page
* @page: the page to add the mapping to
* @vma: the vm area in which the mapping is added
* page_add_new_anon_rmap - add pte mapping to a new anonymous page
* @page: the page to add the mapping to
* @vma: the vm area in which the mapping is added
@@
-605,6
+626,8
@@
void page_add_file_rmap(struct page *page)
/**
* page_dup_rmap - duplicate pte mapping to a page
* @page: the page to add the mapping to
/**
* page_dup_rmap - duplicate pte mapping to a page
* @page: the page to add the mapping to
+ * @vma: the vm area being duplicated
+ * @address: the user virtual address mapped
*
* For copy_page_range only: minimal extract from page_add_file_rmap /
* page_add_anon_rmap, avoiding unnecessary tests (already checked) so it's
*
* For copy_page_range only: minimal extract from page_add_file_rmap /
* page_add_anon_rmap, avoiding unnecessary tests (already checked) so it's
@@
-624,6
+647,7
@@
void page_dup_rmap(struct page *page, struct vm_area_struct *vma, unsigned long
/**
* page_remove_rmap - take down pte mapping from a page
* @page: page to remove mapping from
/**
* page_remove_rmap - take down pte mapping from a page
* @page: page to remove mapping from
+ * @vma: the vm area in which the mapping is removed
*
* The caller needs to hold the pte lock.
*/
*
* The caller needs to hold the pte lock.
*/
@@
-638,7
+662,6
@@
void page_remove_rmap(struct page *page, struct vm_area_struct *vma)
printk (KERN_EMERG " page->mapping = %p\n", page->mapping);
print_symbol (KERN_EMERG " vma->vm_ops = %s\n", (unsigned long)vma->vm_ops);
if (vma->vm_ops) {
printk (KERN_EMERG " page->mapping = %p\n", page->mapping);
print_symbol (KERN_EMERG " vma->vm_ops = %s\n", (unsigned long)vma->vm_ops);
if (vma->vm_ops) {
- print_symbol (KERN_EMERG " vma->vm_ops->nopage = %s\n", (unsigned long)vma->vm_ops->nopage);
print_symbol (KERN_EMERG " vma->vm_ops->fault = %s\n", (unsigned long)vma->vm_ops->fault);
}
if (vma->vm_file && vma->vm_file->f_op)
print_symbol (KERN_EMERG " vma->vm_ops->fault = %s\n", (unsigned long)vma->vm_ops->fault);
}
if (vma->vm_file && vma->vm_file->f_op)
@@
-872,6
+895,7
@@
static int try_to_unmap_anon(struct page *page, int migration)
/**
* try_to_unmap_file - unmap file page using the object-based rmap method
* @page: the page to unmap
/**
* try_to_unmap_file - unmap file page using the object-based rmap method
* @page: the page to unmap
+ * @migration: migration flag
*
* Find all the mappings of a page using the mapping pointer and the vma chains
* contained in the address_space struct it points to.
*
* Find all the mappings of a page using the mapping pointer and the vma chains
* contained in the address_space struct it points to.
@@
-968,6
+992,7
@@
out:
/**
* try_to_unmap - try to remove all page table mappings to a page
* @page: the page to get unmapped
/**
* try_to_unmap - try to remove all page table mappings to a page
* @page: the page to get unmapped
+ * @migration: migration flag
*
* Tries to remove all the page table entries which are mapping this
* page, used in the pageout path. Caller must hold the page lock.
*
* Tries to remove all the page table entries which are mapping this
* page, used in the pageout path. Caller must hold the page lock.
This page took
0.092276 seconds
and
5
git commands to generate.