]> git.baikalelectronics.ru Git - kernel.git/commit
nommu: Correct kobjsize() page validity checks.
authorPaul Mundt <lethal@linux-sh.org>
Thu, 12 Jun 2008 07:29:55 +0000 (16:29 +0900)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 12 Jun 2008 14:56:17 +0000 (07:56 -0700)
commit187efc7f9f118160e7aab419772ec1f14cd485aa
tree822e2711385da42bd3b53472b74ee99963913915
parentd840192327c6e71552c0fbff6b541930be0ca182
nommu: Correct kobjsize() page validity checks.

This implements a few changes on top of the recent kobjsize() refactoring
introduced by commit b7218421ad99f79ac9d06b1c410df1493cd783bc.

As Christoph points out:

virt_to_head_page cannot return NULL. virt_to_page also
does not return NULL. pfn_valid() needs to be used to
figure out if a page is valid.  Otherwise the page struct
reference that was returned may have PageReserved() set
to indicate that it is not a valid page.

As discussed further in the thread, virt_addr_valid() is the preferable
way to validate the object pointer in this case. In addition to fixing
up the reserved page case, it also has the benefit of encapsulating the
hack introduced by commit 5e13b7c816b6b1a0f9e64ffb76ad2177f7aad1ae on
the impacted platforms, allowing us to get rid of the extra checking in
kobjsize() for the platforms that don't perform this type of bizarre
memory_end abuse (every nommu platform that isn't blackfin). If blackfin
decides to get in line with every other platform and use PageReserved
for the DMA pages in question, kobjsize() will also continue to work
fine.

It also turns out that compound_order() will give us back 0-order for
non-head pages, so we can get rid of the PageCompound check and just
use compound_order() directly. Clean that up while we're at it.

Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Reviewed-by: Christoph Lameter <clameter@sgi.com>
Acked-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/nommu.c