Skip to content

Commit be74273

Browse files
Matthew Wilcox (Oracle)Rich Felker
authored andcommitted
sh: Fix unneeded constructor in page table allocation
The pgd kmem_cache allocation both specified __GFP_ZERO and had a constructor which makes no sense. Remove __GFP_ZERO and zero the user parts of the pgd explicitly. Signed-off-by: Matthew Wilcox (Oracle) <[email protected]> Signed-off-by: Rich Felker <[email protected]>
1 parent bcf8768 commit be74273

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

arch/sh/mm/pgtable.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#include <linux/mm.h>
33
#include <linux/slab.h>
44

5-
#define PGALLOC_GFP GFP_KERNEL | __GFP_ZERO
6-
75
static struct kmem_cache *pgd_cachep;
86
#if PAGETABLE_LEVELS > 2
97
static struct kmem_cache *pmd_cachep;
@@ -13,6 +11,7 @@ void pgd_ctor(void *x)
1311
{
1412
pgd_t *pgd = x;
1513

14+
memset(pgd, 0, USER_PTRS_PER_PGD * sizeof(pgd_t));
1615
memcpy(pgd + USER_PTRS_PER_PGD,
1716
swapper_pg_dir + USER_PTRS_PER_PGD,
1817
(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));
@@ -32,7 +31,7 @@ void pgtable_cache_init(void)
3231

3332
pgd_t *pgd_alloc(struct mm_struct *mm)
3433
{
35-
return kmem_cache_alloc(pgd_cachep, PGALLOC_GFP);
34+
return kmem_cache_alloc(pgd_cachep, GFP_KERNEL);
3635
}
3736

3837
void pgd_free(struct mm_struct *mm, pgd_t *pgd)
@@ -48,7 +47,7 @@ void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)
4847

4948
pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
5049
{
51-
return kmem_cache_alloc(pmd_cachep, PGALLOC_GFP);
50+
return kmem_cache_alloc(pmd_cachep, GFP_KERNEL | __GFP_ZERO);
5251
}
5352

5453
void pmd_free(struct mm_struct *mm, pmd_t *pmd)

0 commit comments

Comments
 (0)