]> git.baikalelectronics.ru Git - kernel.git/commit
mm: get rid of the most spurious find_vma_prev() users
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Jun 2011 07:35:09 +0000 (00:35 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Jun 2011 07:35:09 +0000 (00:35 -0700)
commitef18cc5c45a102d497d3171fa6437f8024a31335
tree43db860557f3080b254291dac1035be1468dfdff
parent597dddcf08235bcc47de7a360ac24cf2b1d65e0d
mm: get rid of the most spurious find_vma_prev() users

We have some users of this function that date back to before the vma
list was doubly linked, and just are silly.  These days, you can find
the previous vma by just following the vma->vm_prev pointer.

In some cases you don't need any find_vma() lookup at all, and in other
cases you're better off with the regular "find_vma()" that uses the vma
cache front-end lookup.

Some "find_vma_prev()" users are still valid, though.  For example, in
the case of a stack that grows up, it can be the case that we don't find
any 'vma' at all (because we're looking up an address that is past the
last vma), and that the stack that we want to grow is the 'prev' vma.

But that kind of special case aside, we generally should prefer to use
'find_vma()'.

Noticed due to a totally unrelated POWER memory corruption bug that just
happened to hit in 'find_vma_prev()' and made me go "Hmm - why are we
using that function here?".

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c