When the memset code was added to pgd_alloc(), it failed to consider that 
kmem_cache_alloc() can return NULL.  It's uncommon, but not impossible under 
heavy memory contention.

Signed-off-by: Rick Lindsley <rickl...@vnet.linux.ibm.com>
Fixes: cf266dbcd2a7 ("Zero PGD pages on allocation")

--- a/arch/powerpc/include/asm/book3s/64/pgalloc.h
+++ b/arch/powerpc/include/asm/book3s/64/pgalloc.h
@@ -81,6 +81,10 @@ static inline pgd_t *pgd_alloc(struct mm
pgd = kmem_cache_alloc(PGT_CACHE(PGD_INDEX_SIZE),
                               pgtable_gfp_flags(mm, GFP_KERNEL));
+
+       if (unlikely(!pgd))
+               return pgd;
+
        /*
         * Don't scan the PGD for pointers, it contains references to PUDs but
         * those references are not full pointers and so can't be recognised by

Reply via email to