mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -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
4
mm/ksm.c
4
mm/ksm.c
|
|
@ -318,14 +318,14 @@ static void hold_anon_vma(struct rmap_item *rmap_item,
|
|||
struct anon_vma *anon_vma)
|
||||
{
|
||||
rmap_item->anon_vma = anon_vma;
|
||||
atomic_inc(&anon_vma->ksm_refcount);
|
||||
atomic_inc(&anon_vma->external_refcount);
|
||||
}
|
||||
|
||||
static void drop_anon_vma(struct rmap_item *rmap_item)
|
||||
{
|
||||
struct anon_vma *anon_vma = rmap_item->anon_vma;
|
||||
|
||||
if (atomic_dec_and_lock(&anon_vma->ksm_refcount, &anon_vma->lock)) {
|
||||
if (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