lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1298028635.5226.685.camel@laptop>
Date:	Fri, 18 Feb 2011 12:30:35 +0100
From:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	Andrea Arcangeli <aarcange@...hat.com>,
	Avi Kivity <avi@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Rik van Riel <riel@...hat.com>, Ingo Molnar <mingo@...e.hu>,
	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org,
	Benjamin Herrenschmidt <benh@...nel.crashing.org>,
	David Miller <davem@...emloft.net>,
	Hugh Dickins <hugh.dickins@...cali.co.uk>,
	Mel Gorman <mel@....ul.ie>, Nick Piggin <npiggin@...nel.dk>,
	Paul McKenney <paulmck@...ux.vnet.ibm.com>,
	Yanmin Zhang <yanmin_zhang@...ux.intel.com>,
	Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH 3/3] mm: Simplify anon_vma refcounts

On Thu, 2011-02-17 at 10:30 -0800, Linus Torvalds wrote:
> On Thu, Feb 17, 2011 at 8:19 AM, Peter Zijlstra <a.p.zijlstra@...llo.nl> wrote:
> >
> > +void __put_anon_vma(struct anon_vma *anon_vma)
> > +{
> > +       if (anon_vma->root != anon_vma)
> > +               put_anon_vma(anon_vma->root);
> > +       anon_vma_free(anon_vma);
> >  }
> 
> So this makes me nervous. It looks like recursion.
> 
> Now, I don't think we can ever get a chain of these things (because
> the root should be the root of everything),

Exactly.

>  but I still preferred the
> older code that made that "one-level root" case explicit, and didn't
> have recursion.
> 
> IOW, even though it should be entirely equivalent, I think I'd really
> prefer something like
> 
>   void __put_anon_vma(struct anon_vma *anon_vma)
>   {
>     struct anon_vma *root = anon_vma->root;
> 
>     if (root != anon_vma && atomic_dec_and_test(&root->refcount))
>       anon_vma_free(root);
>     anon_vma_free(anon_vma);
>   }
> 
> instead. Exactly because it makes it very clear that the "root" is a
> root, and we're not doing some possibly arbitrarily deep list like the
> dentry tree (which avoids recursion by open-coding its freeing as a
> loop).
> 
> Hmm? (The above is obviously untested, maybe it has some stupid bug)

Looks about right, I'll give it a spin. 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ