/*1* This file is subject to the terms and conditions of the GNU General Public2* License. See the file "COPYING" in the main directory of this archive3* for more details.4*/5#include <linux/export.h>6#include <linux/mm.h>7#include <linux/string.h>8#include <asm/pgalloc.h>910pgd_t *pgd_alloc(struct mm_struct *mm)11{12pgd_t *init, *ret;1314ret = __pgd_alloc(mm, PGD_TABLE_ORDER);15if (ret) {16init = pgd_offset(&init_mm, 0UL);17pgd_init(ret);18memcpy(ret + USER_PTRS_PER_PGD, init + USER_PTRS_PER_PGD,19(PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t));20}2122return ret;23}24EXPORT_SYMBOL_GPL(pgd_alloc);252627