Commit:     b5fab14e5d87df4d94161ae5f5e0c8625f9ffda2
Parent:     a0acd820807680d2ccc4ef3448387fcdbf152c73
Author:     Christoph Lameter <[EMAIL PROTECTED]>
AuthorDate: Tue Jul 17 04:03:33 2007 -0700
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Tue Jul 17 10:23:02 2007 -0700

    Add VM_BUG_ON in case someone uses page_mapping on a slab page
    Detect slab objects being passed to the page oriented functions of the VM.
    It is not sufficient to simply return NULL because the functions calling
    page_mapping may depend on other items of the page_struct also to be setup
    properly.  Moreover slab object may not be properly aligned.  The page
    oriented functions of the VM expect to operate on page aligned, page sized
    objects.  Operations on object straddling page boundaries may only affect 
    objects partially which may lead to surprising results.
    It is better to detect eventually remaining uses and eliminate them.
    Signed-off-by: Christoph Lameter <[EMAIL PROTECTED]>
    Cc: Hugh Dickins <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 include/linux/mm.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 4c482a3..a5c4518 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -599,6 +599,7 @@ static inline struct address_space *page_mapping(struct 
page *page)
        struct address_space *mapping = page->mapping;
+       VM_BUG_ON(PageSlab(page));
        if (unlikely(PageSwapCache(page)))
                mapping = &swapper_space;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to