powerpc/mm: remove unnecessary test in pgtable_cache_init()
authorChristophe Leroy <christophe.leroy@c-s.fr>
Thu, 29 Nov 2018 14:07:09 +0000 (14:07 +0000)
committerMichael Ellerman <mpe@ellerman.id.au>
Tue, 4 Dec 2018 08:45:01 +0000 (19:45 +1100)
pgtable_cache_add() gracefully handles the case when a cache that
size already exists by returning early with the following test:

if (PGT_CACHE(shift))
return; /* Already have a cache of this size */

It is then not needed to test the existence of the cache before.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/mm/init-common.c

index b7ca03643d0be22948a482ccbf6b0160b242278c..1e6910eb70ed1ab56cb5ea1ad41b7cef93fd7e73 100644 (file)
@@ -111,13 +111,13 @@ void pgtable_cache_init(void)
 {
        pgtable_cache_add(PGD_INDEX_SIZE);
 
-       if (PMD_CACHE_INDEX && !PGT_CACHE(PMD_CACHE_INDEX))
+       if (PMD_CACHE_INDEX)
                pgtable_cache_add(PMD_CACHE_INDEX);
        /*
         * In all current configs, when the PUD index exists it's the
         * same size as either the pgd or pmd index except with THP enabled
         * on book3s 64
         */
-       if (PUD_CACHE_INDEX && !PGT_CACHE(PUD_CACHE_INDEX))
+       if (PUD_CACHE_INDEX)
                pgtable_cache_add(PUD_CACHE_INDEX);
 }