Release 4.14 arch/parisc/include/asm/pgalloc.h
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_PGALLOC_H
#define _ASM_PGALLOC_H
#include <linux/gfp.h>
#include <linux/mm.h>
#include <linux/threads.h>
#include <asm/processor.h>
#include <asm/fixmap.h>
#include <asm/cache.h>
/* Allocate the top level pgd (page directory)
*
* Here (for 64 bit kernels) we implement a Hybrid L2/L3 scheme: we
* allocate the first pmd adjacent to the pgd. This means that we can
* subtract a constant offset to get to it. The pmd and pgd sizes are
* arranged so that a single pmd covers 4GB (giving a full 64-bit
* process access to 8TB) so our lookups are effectively L2 for the
* first 4GB of the kernel (i.e. for all ILP32 processes and all the
* kernel for machines with under 4GB of memory) */
static inline pgd_t *pgd_alloc(struct mm_struct *mm)
{
pgd_t *pgd = (pgd_t *)__get_free_pages(GFP_KERNEL,
PGD_ALLOC_ORDER);
pgd_t *actual_pgd = pgd;
if (likely(pgd != NULL)) {
memset(pgd, 0, PAGE_SIZE<<PGD_ALLOC_ORDER);
#if CONFIG_PGTABLE_LEVELS == 3
actual_pgd += PTRS_PER_PGD;
/* Populate first pmd with allocated memory. We mark it
* with PxD_FLAG_ATTACHED as a signal to the system that this
* pmd entry may not be cleared. */
__pgd_val_set(*actual_pgd, (PxD_FLAG_PRESENT |
PxD_FLAG_VALID |
PxD_FLAG_ATTACHED)
+ (__u32)(__pa((unsigned long)pgd) >> PxD_VALUE_SHIFT));
/* The first pmd entry also is marked with PxD_FLAG_ATTACHED as
* a signal that this pmd may not be freed */
__pgd_val_set(*pgd, PxD_FLAG_ATTACHED);
#endif
}
return actual_pgd;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 83 | 75.45% | 3 | 42.86% |
Linus Torvalds (pre-git) | 21 | 19.09% | 1 | 14.29% |
Helge Deller | 5 | 4.55% | 2 | 28.57% |
Guenter Roeck | 1 | 0.91% | 1 | 14.29% |
Total | 110 | 100.00% | 7 | 100.00% |
static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd)
{
#if CONFIG_PGTABLE_LEVELS == 3
pgd -= PTRS_PER_PGD;
#endif
free_pages((unsigned long)pgd, PGD_ALLOC_ORDER);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 15 | 39.47% | 2 | 33.33% |
Linus Torvalds (pre-git) | 13 | 34.21% | 1 | 16.67% |
Benjamin Herrenschmidt | 5 | 13.16% | 1 | 16.67% |
Helge Deller | 4 | 10.53% | 1 | 16.67% |
Guenter Roeck | 1 | 2.63% | 1 | 16.67% |
Total | 38 | 100.00% | 6 | 100.00% |
#if CONFIG_PGTABLE_LEVELS == 3
/* Three Level Page Table Support for pmd's */
static inline void pgd_populate(struct mm_struct *mm, pgd_t *pgd, pmd_t *pmd)
{
__pgd_val_set(*pgd, (PxD_FLAG_PRESENT | PxD_FLAG_VALID) +
(__u32)(__pa((unsigned long)pmd) >> PxD_VALUE_SHIFT));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 27 | 56.25% | 3 | 75.00% |
Linus Torvalds (pre-git) | 21 | 43.75% | 1 | 25.00% |
Total | 48 | 100.00% | 4 | 100.00% |
static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
{
pmd_t *pmd = (pmd_t *)__get_free_pages(GFP_KERNEL, PMD_ORDER);
if (pmd)
memset(pmd, 0, PAGE_SIZE<<PMD_ORDER);
return pmd;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 32 | 64.00% | 2 | 66.67% |
Linus Torvalds (pre-git) | 18 | 36.00% | 1 | 33.33% |
Total | 50 | 100.00% | 3 | 100.00% |
static inline void pmd_free(struct mm_struct *mm, pmd_t *pmd)
{
if (pmd_flag(*pmd) & PxD_FLAG_ATTACHED) {
/*
* This is the permanent pmd attached to the pgd;
* cannot free it.
* Increment the counter to compensate for the decrement
* done by generic mm code.
*/
mm_inc_nr_pmds(mm);
return;
}
free_pages((unsigned long)pmd, PMD_ORDER);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 20 | 43.48% | 3 | 42.86% |
Linus Torvalds (pre-git) | 13 | 28.26% | 1 | 14.29% |
Mikulas Patocka | 6 | 13.04% | 1 | 14.29% |
Benjamin Herrenschmidt | 5 | 10.87% | 1 | 14.29% |
Christophe Jaillet | 2 | 4.35% | 1 | 14.29% |
Total | 46 | 100.00% | 7 | 100.00% |
#else
/* Two Level Page Table Support for pmd's */
/*
* allocating and freeing a pmd is trivial: the 1-entry pmd is
* inside the pgd, so has no extra memory associated with it.
*/
#define pmd_alloc_one(mm, addr) ({ BUG(); ((pmd_t *)2); })
#define pmd_free(mm, x) do { } while (0)
#define pgd_populate(mm, pmd, pte) BUG()
#endif
static inline void
pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd, pte_t *pte)
{
#if CONFIG_PGTABLE_LEVELS == 3
/* preserve the gateway marker if this is the beginning of
* the permanent pmd */
if(pmd_flag(*pmd) & PxD_FLAG_ATTACHED)
__pmd_val_set(*pmd, (PxD_FLAG_PRESENT |
PxD_FLAG_VALID |
PxD_FLAG_ATTACHED)
+ (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT));
else
#endif
__pmd_val_set(*pmd, (PxD_FLAG_PRESENT | PxD_FLAG_VALID)
+ (__u32)(__pa((unsigned long)pte) >> PxD_VALUE_SHIFT));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 86 | 88.66% | 3 | 50.00% |
Linus Torvalds (pre-git) | 6 | 6.19% | 1 | 16.67% |
Helge Deller | 4 | 4.12% | 1 | 16.67% |
Guenter Roeck | 1 | 1.03% | 1 | 16.67% |
Total | 97 | 100.00% | 6 | 100.00% |
#define pmd_populate(mm, pmd, pte_page) \
pmd_populate_kernel(mm, pmd, page_address(pte_page))
#define pmd_pgtable(pmd) pmd_page(pmd)
static inline pgtable_t
pte_alloc_one(struct mm_struct *mm, unsigned long address)
{
struct page *page = alloc_page(GFP_KERNEL|__GFP_ZERO);
if (!page)
return NULL;
if (!pgtable_page_ctor(page)) {
__free_page(page);
return NULL;
}
return page;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Kirill A. Shutemov | 17 | 29.82% | 1 | 16.67% |
Matthew Wilcox | 16 | 28.07% | 1 | 16.67% |
Linus Torvalds (pre-git) | 12 | 21.05% | 1 | 16.67% |
Martin Schwidefsky | 10 | 17.54% | 1 | 16.67% |
Christoph Lameter | 1 | 1.75% | 1 | 16.67% |
Andrew Morton | 1 | 1.75% | 1 | 16.67% |
Total | 57 | 100.00% | 6 | 100.00% |
static inline pte_t *
pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr)
{
pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL|__GFP_ZERO);
return pte;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 25 | 71.43% | 1 | 25.00% |
Linus Torvalds (pre-git) | 8 | 22.86% | 1 | 25.00% |
Andrew Morton | 1 | 2.86% | 1 | 25.00% |
Christoph Lameter | 1 | 2.86% | 1 | 25.00% |
Total | 35 | 100.00% | 4 | 100.00% |
static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
{
free_page((unsigned long)pte);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 16 | 64.00% | 1 | 33.33% |
Benjamin Herrenschmidt | 5 | 20.00% | 1 | 33.33% |
Linus Torvalds (pre-git) | 4 | 16.00% | 1 | 33.33% |
Total | 25 | 100.00% | 3 | 100.00% |
static inline void pte_free(struct mm_struct *mm, struct page *pte)
{
pgtable_page_dtor(pte);
pte_free_kernel(mm, page_address(pte));
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Martin Schwidefsky | 17 | 53.12% | 1 | 25.00% |
Kyle McMartin | 10 | 31.25% | 1 | 25.00% |
Matthew Wilcox | 3 | 9.38% | 1 | 25.00% |
Benjamin Herrenschmidt | 2 | 6.25% | 1 | 25.00% |
Total | 32 | 100.00% | 4 | 100.00% |
#define check_pgt_cache() do { } while (0)
#endif
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
Matthew Wilcox | 373 | 59.11% | 3 | 15.79% |
Linus Torvalds (pre-git) | 144 | 22.82% | 1 | 5.26% |
Martin Schwidefsky | 34 | 5.39% | 1 | 5.26% |
Benjamin Herrenschmidt | 19 | 3.01% | 1 | 5.26% |
Kirill A. Shutemov | 18 | 2.85% | 2 | 10.53% |
Helge Deller | 14 | 2.22% | 3 | 15.79% |
Kyle McMartin | 10 | 1.58% | 1 | 5.26% |
Mikulas Patocka | 6 | 0.95% | 1 | 5.26% |
Linus Torvalds | 3 | 0.48% | 1 | 5.26% |
Guenter Roeck | 3 | 0.48% | 1 | 5.26% |
Andrew Morton | 2 | 0.32% | 1 | 5.26% |
Christoph Lameter | 2 | 0.32% | 1 | 5.26% |
Christophe Jaillet | 2 | 0.32% | 1 | 5.26% |
Greg Kroah-Hartman | 1 | 0.16% | 1 | 5.26% |
Total | 631 | 100.00% | 19 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.