Linux Audio

Check our new training course

Loading...
v3.15
 
 1#ifndef __ASM_SH_PGALLOC_H
 2#define __ASM_SH_PGALLOC_H
 3
 4#include <linux/quicklist.h>
 5#include <asm/page.h>
 6
 7#define QUICK_PT 0	/* Other page table pages that are zero on free */
 
 
 
 8
 9extern pgd_t *pgd_alloc(struct mm_struct *);
10extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
11
12#if PAGETABLE_LEVELS > 2
13extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
14extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
15extern void pmd_free(struct mm_struct *mm, pmd_t *pmd);
 
16#endif
17
18static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
19				       pte_t *pte)
20{
21	set_pmd(pmd, __pmd((unsigned long)pte));
22}
23
24static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
25				pgtable_t pte)
26{
27	set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
28}
29#define pmd_pgtable(pmd) pmd_page(pmd)
30
31/*
32 * Allocate and free page tables.
33 */
34static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm,
35					  unsigned long address)
36{
37	return quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
38}
39
40static inline pgtable_t pte_alloc_one(struct mm_struct *mm,
41					unsigned long address)
42{
43	struct page *page;
44	void *pg;
45
46	pg = quicklist_alloc(QUICK_PT, GFP_KERNEL | __GFP_REPEAT, NULL);
47	if (!pg)
48		return NULL;
49	page = virt_to_page(pg);
50	if (!pgtable_page_ctor(page)) {
51		quicklist_free(QUICK_PT, NULL, pg);
52		return NULL;
53	}
54	return page;
55}
56
57static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte)
58{
59	quicklist_free(QUICK_PT, NULL, pte);
60}
61
62static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
63{
64	pgtable_page_dtor(pte);
65	quicklist_free_page(QUICK_PT, NULL, pte);
66}
67
68#define __pte_free_tlb(tlb,pte,addr)			\
69do {							\
70	pgtable_page_dtor(pte);				\
71	tlb_remove_page((tlb), (pte));			\
72} while (0)
73
74static inline void check_pgt_cache(void)
75{
76	quicklist_trim(QUICK_PT, NULL, 25, 16);
77}
78
79#endif /* __ASM_SH_PGALLOC_H */
v6.9.4
 1/* SPDX-License-Identifier: GPL-2.0 */
 2#ifndef __ASM_SH_PGALLOC_H
 3#define __ASM_SH_PGALLOC_H
 4
 5#include <linux/mm.h>
 6#include <asm/page.h>
 7
 8#define __HAVE_ARCH_PMD_ALLOC_ONE
 9#define __HAVE_ARCH_PMD_FREE
10#define __HAVE_ARCH_PGD_FREE
11#include <asm-generic/pgalloc.h>
12
13extern pgd_t *pgd_alloc(struct mm_struct *);
14extern void pgd_free(struct mm_struct *mm, pgd_t *pgd);
15
16#if PAGETABLE_LEVELS > 2
17extern void pud_populate(struct mm_struct *mm, pud_t *pudp, pmd_t *pmd);
18extern pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address);
19extern void pmd_free(struct mm_struct *mm, pmd_t *pmd);
20#define __pmd_free_tlb(tlb, pmdp, addr)		pmd_free((tlb)->mm, (pmdp))
21#endif
22
23static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
24				       pte_t *pte)
25{
26	set_pmd(pmd, __pmd((unsigned long)pte));
27}
28
29static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd,
30				pgtable_t pte)
31{
32	set_pmd(pmd, __pmd((unsigned long)page_address(pte)));
33}
 
34
35#define __pte_free_tlb(tlb, pte, addr)				\
36do {								\
37	pagetable_pte_dtor(page_ptdesc(pte));			\
38	tlb_remove_page_ptdesc((tlb), (page_ptdesc(pte)));	\
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39} while (0)
 
 
 
 
 
40
41#endif /* __ASM_SH_PGALLOC_H */