Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176286
b: refs/heads/master
c: 93d1771
h: refs/heads/master
v: v3
  • Loading branch information
Hugh Dickins authored and Linus Torvalds committed Dec 15, 2009
1 parent bcce389 commit e0b67ad
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 338fde90930eaa02f6f394daa23d35a410af5852
refs/heads/master: 93d17715a5b960d34220f2edba3e6cee9b5b1c58
17 changes: 6 additions & 11 deletions trunk/mm/ksm.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,7 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
}

rmap_item->next = NULL;
rmap_item->address &= PAGE_MASK;

} else if (rmap_item->address & NODE_FLAG) {
unsigned char age;
Expand All @@ -467,11 +468,11 @@ static void remove_rmap_item_from_tree(struct rmap_item *rmap_item)
BUG_ON(age > 1);
if (!age)
rb_erase(&rmap_item->node, &root_unstable_tree);

ksm_pages_unshared--;
rmap_item->address &= PAGE_MASK;
}

rmap_item->address &= PAGE_MASK;

cond_resched(); /* we're called from many long loops */
}

Expand Down Expand Up @@ -1086,8 +1087,7 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
unsigned int checksum;
int err;

if (in_stable_tree(rmap_item))
remove_rmap_item_from_tree(rmap_item);
remove_rmap_item_from_tree(rmap_item);

/* We first start with searching the page inside the stable tree */
tree_rmap_item = stable_tree_search(page, page2, rmap_item);
Expand Down Expand Up @@ -1143,9 +1143,7 @@ static void cmp_and_merge_page(struct page *page, struct rmap_item *rmap_item)
* tree, and insert it instead as new node in the stable tree.
*/
if (!err) {
rb_erase(&tree_rmap_item->node, &root_unstable_tree);
tree_rmap_item->address &= ~NODE_FLAG;
ksm_pages_unshared--;
remove_rmap_item_from_tree(tree_rmap_item);

/*
* If we fail to insert the page into the stable tree,
Expand Down Expand Up @@ -1174,11 +1172,8 @@ static struct rmap_item *get_next_rmap_item(struct mm_slot *mm_slot,

while (cur != &mm_slot->rmap_list) {
rmap_item = list_entry(cur, struct rmap_item, link);
if ((rmap_item->address & PAGE_MASK) == addr) {
if (!in_stable_tree(rmap_item))
remove_rmap_item_from_tree(rmap_item);
if ((rmap_item->address & PAGE_MASK) == addr)
return rmap_item;
}
if (rmap_item->address > addr)
break;
cur = cur->next;
Expand Down

0 comments on commit e0b67ad

Please sign in to comment.