linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org
Subject: [PATCH -mm] only drop root anon_vma if not self
Date: Wed, 9 Jun 2010 21:16:17 -0400	[thread overview]
Message-ID: <20100609211617.3e7e41bd@annuminas.surriel.com> (raw)
In-Reply-To: <AANLkTik-cwrabXH_bQRPFtTo3C9r30B83jMf4IwJKCms@mail.gmail.com>

On Wed, 9 Jun 2010 17:19:02 +0800
Dave Young <hidave.darkstar@gmail.com> wrote:

> > Manually bisected mm patches, the memleak caused by following patch:
> >
> > mm-extend-ksm-refcounts-to-the-anon_vma-root.patch
>
> 
> So I guess the refcount break, either drop-without-get or over-drop

I'm guessing I did not run the kernel with enough debug options enabled
when I tested my patches...

Dave & Catalin, thank you for tracking this down.

Dave, does the below patch fix your issue?

Andrew, if the patch below works, you'll probably want to merge it as
mm-extend-ksm-refcounts-to-the-anon_vma-root-fix.patch :)

----------------

With the new anon_vma code we take a refcount on the root anon_vma.
However, the root anon_vma does not have a refcount on itself, so
we should not try to do a drop on itself when it is being unlinked.

Signed-off-by: Rik van Riel <riel@redhat.com>

--- linux-2.6-rtavma/mm/rmap.c.orig	2010-06-09 21:10:07.349376896 -0400
+++ linux-2.6-rtavma/mm/rmap.c	2010-06-09 21:10:24.180406299 -0400
@@ -275,7 +275,8 @@ static void anon_vma_unlink(struct anon_
 
 	if (empty) {
 		/* We no longer need the root anon_vma */
-		drop_anon_vma(anon_vma->root);
+		if (anon_vma->root != anon_vma)
+			drop_anon_vma(anon_vma->root);
 		anon_vma_free(anon_vma);
 	}
 }

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-06-10  1:16 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-04  8:27 mmotm 2010-06-03-16-36 lots of suspected kmemleak Dave Young
2010-06-04 10:50 ` Catalin Marinas
2010-06-04 13:55   ` Dave Young
2010-06-07  5:20     ` Dave Young
2010-06-07  9:19       ` Catalin Marinas
2010-06-07 10:00         ` Dave Young
2010-06-07 16:43           ` Catalin Marinas
2010-06-08  1:37             ` Dave Young
2010-06-09  2:37             ` Dave Young
2010-06-09  2:44               ` Dave Young
2010-06-09  9:19               ` Dave Young
2010-06-10  1:16                 ` Rik van Riel [this message]
2010-06-10  1:30                   ` [PATCH -mm] only drop root anon_vma if not self Dave Young
2010-06-10 11:21                     ` Catalin Marinas
2010-06-11  8:08                       ` Dave Young
2010-06-11  9:17                         ` Catalin Marinas
2010-06-11  9:30                           ` Dave Young
2010-06-11  9:48                             ` Dave Young
2010-06-11 10:06                               ` Catalin Marinas
2010-06-12  1:50                                 ` Dave Young
2010-06-07  8:30 ` mmotm 2010-06-03-16-36 lots of suspected kmemleak Dave Young

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100609211617.3e7e41bd@annuminas.surriel.com \
    --to=riel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).