forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mm: move p?d_alloc_track to separate header file
The functions are only used in two source files, so there is no need for them to be in the global <linux/mm.h> header. Move them to the new <linux/pgalloc-track.h> header and include it only where needed. Signed-off-by: Joerg Roedel <jroedel@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Reviewed-by: Pekka Enberg <penberg@kernel.org> Cc: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Andy Lutomirski <luto@kernel.org> Cc: Abdul Haleem <abdhalee@linux.vnet.ibm.com> Cc: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: Mike Rapoport <rppt@linux.ibm.com> Cc: Christophe Leroy <christophe.leroy@csgroup.eu> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Max Filippov <jcmvbkbc@gmail.com> Cc: Stafford Horne <shorne@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Matthew Wilcox <willy@infradead.org> Link: http://lkml.kernel.org/r/20200609120533.25867-1-joro@8bytes.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
- Loading branch information
1 parent
ab05eab
commit 2a681cf
Showing
4 changed files
with
54 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* SPDX-License-Identifier: GPL-2.0 */ | ||
#ifndef _LINUX_PGALLLC_TRACK_H | ||
#define _LINUX_PGALLLC_TRACK_H | ||
|
||
#if defined(CONFIG_MMU) | ||
static inline p4d_t *p4d_alloc_track(struct mm_struct *mm, pgd_t *pgd, | ||
unsigned long address, | ||
pgtbl_mod_mask *mod_mask) | ||
{ | ||
if (unlikely(pgd_none(*pgd))) { | ||
if (__p4d_alloc(mm, pgd, address)) | ||
return NULL; | ||
*mod_mask |= PGTBL_PGD_MODIFIED; | ||
} | ||
|
||
return p4d_offset(pgd, address); | ||
} | ||
|
||
static inline pud_t *pud_alloc_track(struct mm_struct *mm, p4d_t *p4d, | ||
unsigned long address, | ||
pgtbl_mod_mask *mod_mask) | ||
{ | ||
if (unlikely(p4d_none(*p4d))) { | ||
if (__pud_alloc(mm, p4d, address)) | ||
return NULL; | ||
*mod_mask |= PGTBL_P4D_MODIFIED; | ||
} | ||
|
||
return pud_offset(p4d, address); | ||
} | ||
|
||
static inline pmd_t *pmd_alloc_track(struct mm_struct *mm, pud_t *pud, | ||
unsigned long address, | ||
pgtbl_mod_mask *mod_mask) | ||
{ | ||
if (unlikely(pud_none(*pud))) { | ||
if (__pmd_alloc(mm, pud, address)) | ||
return NULL; | ||
*mod_mask |= PGTBL_PUD_MODIFIED; | ||
} | ||
|
||
return pmd_offset(pud, address); | ||
} | ||
#endif /* CONFIG_MMU */ | ||
|
||
#define pte_alloc_kernel_track(pmd, address, mask) \ | ||
((unlikely(pmd_none(*(pmd))) && \ | ||
(__pte_alloc_kernel(pmd) || ({*(mask)|=PGTBL_PMD_MODIFIED;0;})))?\ | ||
NULL: pte_offset_kernel(pmd, address)) | ||
|
||
#endif /* _LINUX_PGALLLC_TRACK_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters