hugetlbpage.c (0337966d121ebebf73a1c346123e8112796e684e) hugetlbpage.c (1aea9b3f921003f0880f0676ae85d87c9f1cb4a2)
1/*
2 * IBM System z Huge TLB Page Support for Kernel.
3 *
4 * Copyright IBM Corp. 2007,2016
5 * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
6 */
7
8#define KMSG_COMPONENT "hugetlb"

--- 148 unchanged lines hidden (view full) ---

157 pmdp_xchg_direct(mm, addr, pmdp, __pmd(_SEGMENT_ENTRY_EMPTY));
158 return pte;
159}
160
161pte_t *huge_pte_alloc(struct mm_struct *mm,
162 unsigned long addr, unsigned long sz)
163{
164 pgd_t *pgdp;
1/*
2 * IBM System z Huge TLB Page Support for Kernel.
3 *
4 * Copyright IBM Corp. 2007,2016
5 * Author(s): Gerald Schaefer <gerald.schaefer@de.ibm.com>
6 */
7
8#define KMSG_COMPONENT "hugetlb"

--- 148 unchanged lines hidden (view full) ---

157 pmdp_xchg_direct(mm, addr, pmdp, __pmd(_SEGMENT_ENTRY_EMPTY));
158 return pte;
159}
160
161pte_t *huge_pte_alloc(struct mm_struct *mm,
162 unsigned long addr, unsigned long sz)
163{
164 pgd_t *pgdp;
165 p4d_t *p4dp;
165 pud_t *pudp;
166 pmd_t *pmdp = NULL;
167
168 pgdp = pgd_offset(mm, addr);
166 pud_t *pudp;
167 pmd_t *pmdp = NULL;
168
169 pgdp = pgd_offset(mm, addr);
169 pudp = pud_alloc(mm, pgdp, addr);
170 if (pudp) {
171 if (sz == PUD_SIZE)
172 return (pte_t *) pudp;
173 else if (sz == PMD_SIZE)
174 pmdp = pmd_alloc(mm, pudp, addr);
170 p4dp = p4d_alloc(mm, pgdp, addr);
171 if (p4dp) {
172 pudp = pud_alloc(mm, p4dp, addr);
173 if (pudp) {
174 if (sz == PUD_SIZE)
175 return (pte_t *) pudp;
176 else if (sz == PMD_SIZE)
177 pmdp = pmd_alloc(mm, pudp, addr);
178 }
175 }
176 return (pte_t *) pmdp;
177}
178
179pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
180{
181 pgd_t *pgdp;
179 }
180 return (pte_t *) pmdp;
181}
182
183pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
184{
185 pgd_t *pgdp;
186 p4d_t *p4dp;
182 pud_t *pudp;
183 pmd_t *pmdp = NULL;
184
185 pgdp = pgd_offset(mm, addr);
186 if (pgd_present(*pgdp)) {
187 pud_t *pudp;
188 pmd_t *pmdp = NULL;
189
190 pgdp = pgd_offset(mm, addr);
191 if (pgd_present(*pgdp)) {
187 pudp = pud_offset(pgdp, addr);
188 if (pud_present(*pudp)) {
189 if (pud_large(*pudp))
190 return (pte_t *) pudp;
191 pmdp = pmd_offset(pudp, addr);
192 p4dp = p4d_offset(pgdp, addr);
193 if (p4d_present(*p4dp)) {
194 pudp = pud_offset(p4dp, addr);
195 if (pud_present(*pudp)) {
196 if (pud_large(*pudp))
197 return (pte_t *) pudp;
198 pmdp = pmd_offset(pudp, addr);
199 }
192 }
193 }
194 return (pte_t *) pmdp;
195}
196
197int pmd_huge(pmd_t pmd)
198{
199 return pmd_large(pmd);

--- 36 unchanged lines hidden ---
200 }
201 }
202 return (pte_t *) pmdp;
203}
204
205int pmd_huge(pmd_t pmd)
206{
207 return pmd_large(pmd);

--- 36 unchanged lines hidden ---