cregit-Linux how code gets into the kernel

Release 4.14 arch/frv/mm/pgalloc.c

Directory: arch/frv/mm
/* pgalloc.c: page directory & page table allocation
 *
 * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#include <linux/sched.h>
#include <linux/gfp.h>
#include <linux/mm.h>
#include <linux/highmem.h>
#include <linux/quicklist.h>
#include <asm/pgalloc.h>
#include <asm/page.h>
#include <asm/cacheflush.h>


pgd_t swapper_pg_dir[PTRS_PER_PGD] __attribute__((aligned(PAGE_SIZE)));


pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address) { pte_t *pte = (pte_t *)__get_free_page(GFP_KERNEL); if (pte) clear_page(pte); return pte; }

Contributors

PersonTokensPropCommitsCommitProp
David Howells40100.00%1100.00%
Total40100.00%1100.00%


pgtable_t pte_alloc_one(struct mm_struct *mm, unsigned long address) { struct page *page; #ifdef CONFIG_HIGHPTE page = alloc_pages(GFP_KERNEL|__GFP_HIGHMEM, 0); #else page = alloc_pages(GFP_KERNEL, 0); #endif if (!page) return NULL; clear_highpage(page); if (!pgtable_page_ctor(page)) { __free_page(page); return NULL; } flush_dcache_page(page); return page; }

Contributors

PersonTokensPropCommitsCommitProp
David Howells6272.94%133.33%
Kirill A. Shutemov1720.00%133.33%
Martin Schwidefsky67.06%133.33%
Total85100.00%3100.00%


void __set_pmd(pmd_t *pmdptr, unsigned long pmd) { unsigned long *__ste_p = pmdptr->ste; int loop; if (!pmd) { memset(__ste_p, 0, PME_SIZE); } else { BUG_ON(pmd & (0x3f00 | xAMPRx_SS | 0xe)); for (loop = PME_SIZE; loop > 0; loop -= 4) { *__ste_p++ = pmd; pmd += __frv_PT_SIZE; } } frv_dcache_writeback((unsigned long) pmdptr, (unsigned long) (pmdptr + 1)); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells102100.00%2100.00%
Total102100.00%2100.00%

/* * List of all pgd's needed for non-PAE so it can invalidate entries * in both cached and uncached pgd's; not needed for PAE since the * kernel pmd is shared. If PAE were not to share the pmd a similar * tactic would be needed. This is essentially codepath-based locking * against pageattr.c; it is the unique case in which a valid change * of kernel pagetables can't be lazily synchronized by vmalloc faults. * vmalloc faults work because attached pagetables are never freed. * If the locking proves to be non-performant, a ticketing scheme with * checks at dup_mmap(), exec(), and other mmlist addition points * could be used. The locking scheme was chosen on the basis of * manfred's recommendations and having no core impact whatsoever. * -- nyc */ DEFINE_SPINLOCK(pgd_lock); struct page *pgd_list;
static inline void pgd_list_add(pgd_t *pgd) { struct page *page = virt_to_page(pgd); page->index = (unsigned long) pgd_list; if (pgd_list) set_page_private(pgd_list, (unsigned long) &page->index); pgd_list = page; set_page_private(page, (unsigned long)&pgd_list); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells6193.85%266.67%
Hugh Dickins46.15%133.33%
Total65100.00%3100.00%


static inline void pgd_list_del(pgd_t *pgd) { struct page *next, **pprev, *page = virt_to_page(pgd); next = (struct page *) page->index; pprev = (struct page **) page_private(page); *pprev = next; if (next) set_page_private(next, (unsigned long) pprev); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells6995.83%266.67%
Hugh Dickins34.17%133.33%
Total72100.00%3100.00%


void pgd_ctor(void *pgd) { unsigned long flags; if (PTRS_PER_PMD == 1) spin_lock_irqsave(&pgd_lock, flags); memcpy((pgd_t *) pgd + USER_PGDS_IN_LAST_PML4, swapper_pg_dir + USER_PGDS_IN_LAST_PML4, (PTRS_PER_PGD - USER_PGDS_IN_LAST_PML4) * sizeof(pgd_t)); if (PTRS_PER_PMD > 1) return; pgd_list_add(pgd); spin_unlock_irqrestore(&pgd_lock, flags); memset(pgd, 0, USER_PGDS_IN_LAST_PML4 * sizeof(pgd_t)); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells87100.00%1100.00%
Total87100.00%1100.00%

/* never called when PTRS_PER_PMD > 1 */
void pgd_dtor(void *pgd) { unsigned long flags; /* can be called from interrupt context */ spin_lock_irqsave(&pgd_lock, flags); pgd_list_del(pgd); spin_unlock_irqrestore(&pgd_lock, flags); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells35100.00%1100.00%
Total35100.00%1100.00%


pgd_t *pgd_alloc(struct mm_struct *mm) { return quicklist_alloc(0, GFP_KERNEL, pgd_ctor); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells1676.19%250.00%
Christoph Lameter419.05%125.00%
Greg Dietsche14.76%125.00%
Total21100.00%4100.00%


void pgd_free(struct mm_struct *mm, pgd_t *pgd) { /* in the non-PAE case, clear_page_tables() clears user pgd entries */ quicklist_free(0, pgd_dtor, pgd); }

Contributors

PersonTokensPropCommitsCommitProp
David Howells1562.50%133.33%
Benjamin Herrenschmidt520.83%133.33%
Christoph Lameter416.67%133.33%
Total24100.00%3100.00%


void __init pgtable_cache_init(void) { }

Contributors

PersonTokensPropCommitsCommitProp
David Howells685.71%150.00%
Christoph Lameter114.29%150.00%
Total7100.00%2100.00%


void check_pgt_cache(void) { quicklist_trim(0, pgd_dtor, 25, 16); }

Contributors

PersonTokensPropCommitsCommitProp
Christoph Lameter1055.56%150.00%
David Howells844.44%150.00%
Total18100.00%2100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
David Howells54489.47%430.77%
Christoph Lameter223.62%17.69%
Kirill A. Shutemov172.80%17.69%
Hugh Dickins71.15%17.69%
Martin Schwidefsky60.99%17.69%
Benjamin Herrenschmidt50.82%17.69%
Thomas Gleixner40.66%17.69%
Greg Dietsche10.16%17.69%
Tejun Heo10.16%17.69%
Nadia Yvette Chambers10.16%17.69%
Total608100.00%13100.00%
Directory: arch/frv/mm
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.