mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
mm: migration: share the anon_vma ref counts between KSM and page migration
For clarity of review, KSM and page migration have separate refcounts on the anon_vma. While clear, this is a waste of memory. This patch gets KSM and page migration to share their toys in a spirit of harmony. Signed-off-by: Mel Gorman <[email protected]> Reviewed-by: Minchan Kim <[email protected]> Reviewed-by: KOSAKI Motohiro <[email protected]> Reviewed-by: Christoph Lameter <[email protected]> Reviewed-by: KAMEZAWA Hiroyuki <[email protected]> Cc: Rik van Riel <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
3f6c82728f
commit
7f60c214fd
4 changed files with 24 additions and 40 deletions
|
|
@ -601,7 +601,7 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
|
|||
rcu_read_lock();
|
||||
rcu_locked = 1;
|
||||
anon_vma = page_anon_vma(page);
|
||||
atomic_inc(&anon_vma->migrate_refcount);
|
||||
atomic_inc(&anon_vma->external_refcount);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -643,7 +643,7 @@ skip_unmap:
|
|||
rcu_unlock:
|
||||
|
||||
/* Drop an anon_vma reference if we took one */
|
||||
if (anon_vma && atomic_dec_and_lock(&anon_vma->migrate_refcount, &anon_vma->lock)) {
|
||||
if (anon_vma && atomic_dec_and_lock(&anon_vma->external_refcount, &anon_vma->lock)) {
|
||||
int empty = list_empty(&anon_vma->head);
|
||||
spin_unlock(&anon_vma->lock);
|
||||
if (empty)
|
||||
|
|
|
|||
Loading…
Reference in a new issue