diff options
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 82 |
1 files changed, 76 insertions, 6 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index 7acc9dc73c9f..c05d7cfbb6b9 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -44,6 +44,9 @@ extern int sysctl_legacy_va_layout; | |||
44 | #include <asm/pgtable.h> | 44 | #include <asm/pgtable.h> |
45 | #include <asm/processor.h> | 45 | #include <asm/processor.h> |
46 | 46 | ||
47 | extern unsigned long sysctl_user_reserve_kbytes; | ||
48 | extern unsigned long sysctl_admin_reserve_kbytes; | ||
49 | |||
47 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) | 50 | #define nth_page(page,n) pfn_to_page(page_to_pfn((page)) + (n)) |
48 | 51 | ||
49 | /* to align the pointer to the (next) page boundary */ | 52 | /* to align the pointer to the (next) page boundary */ |
@@ -87,7 +90,6 @@ extern unsigned int kobjsize(const void *objp); | |||
87 | #define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ | 90 | #define VM_PFNMAP 0x00000400 /* Page-ranges managed without "struct page", just pure PFN */ |
88 | #define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ | 91 | #define VM_DENYWRITE 0x00000800 /* ETXTBSY on write attempts.. */ |
89 | 92 | ||
90 | #define VM_POPULATE 0x00001000 | ||
91 | #define VM_LOCKED 0x00002000 | 93 | #define VM_LOCKED 0x00002000 |
92 | #define VM_IO 0x00004000 /* Memory mapped I/O or similar */ | 94 | #define VM_IO 0x00004000 /* Memory mapped I/O or similar */ |
93 | 95 | ||
@@ -900,7 +902,8 @@ extern void pagefault_out_of_memory(void); | |||
900 | * Flags passed to show_mem() and show_free_areas() to suppress output in | 902 | * Flags passed to show_mem() and show_free_areas() to suppress output in |
901 | * various contexts. | 903 | * various contexts. |
902 | */ | 904 | */ |
903 | #define SHOW_MEM_FILTER_NODES (0x0001u) /* filter disallowed nodes */ | 905 | #define SHOW_MEM_FILTER_NODES (0x0001u) /* disallowed nodes */ |
906 | #define SHOW_MEM_FILTER_PAGE_COUNT (0x0002u) /* page type count */ | ||
904 | 907 | ||
905 | extern void show_free_areas(unsigned int flags); | 908 | extern void show_free_areas(unsigned int flags); |
906 | extern bool skip_free_areas_node(unsigned int flags, int nid); | 909 | extern bool skip_free_areas_node(unsigned int flags, int nid); |
@@ -1295,6 +1298,61 @@ extern void free_area_init_node(int nid, unsigned long * zones_size, | |||
1295 | unsigned long zone_start_pfn, unsigned long *zholes_size); | 1298 | unsigned long zone_start_pfn, unsigned long *zholes_size); |
1296 | extern void free_initmem(void); | 1299 | extern void free_initmem(void); |
1297 | 1300 | ||
1301 | /* | ||
1302 | * Free reserved pages within range [PAGE_ALIGN(start), end & PAGE_MASK) | ||
1303 | * into the buddy system. The freed pages will be poisoned with pattern | ||
1304 | * "poison" if it's non-zero. | ||
1305 | * Return pages freed into the buddy system. | ||
1306 | */ | ||
1307 | extern unsigned long free_reserved_area(unsigned long start, unsigned long end, | ||
1308 | int poison, char *s); | ||
1309 | #ifdef CONFIG_HIGHMEM | ||
1310 | /* | ||
1311 | * Free a highmem page into the buddy system, adjusting totalhigh_pages | ||
1312 | * and totalram_pages. | ||
1313 | */ | ||
1314 | extern void free_highmem_page(struct page *page); | ||
1315 | #endif | ||
1316 | |||
1317 | static inline void adjust_managed_page_count(struct page *page, long count) | ||
1318 | { | ||
1319 | totalram_pages += count; | ||
1320 | } | ||
1321 | |||
1322 | /* Free the reserved page into the buddy system, so it gets managed. */ | ||
1323 | static inline void __free_reserved_page(struct page *page) | ||
1324 | { | ||
1325 | ClearPageReserved(page); | ||
1326 | init_page_count(page); | ||
1327 | __free_page(page); | ||
1328 | } | ||
1329 | |||
1330 | static inline void free_reserved_page(struct page *page) | ||
1331 | { | ||
1332 | __free_reserved_page(page); | ||
1333 | adjust_managed_page_count(page, 1); | ||
1334 | } | ||
1335 | |||
1336 | static inline void mark_page_reserved(struct page *page) | ||
1337 | { | ||
1338 | SetPageReserved(page); | ||
1339 | adjust_managed_page_count(page, -1); | ||
1340 | } | ||
1341 | |||
1342 | /* | ||
1343 | * Default method to free all the __init memory into the buddy system. | ||
1344 | * The freed pages will be poisoned with pattern "poison" if it is | ||
1345 | * non-zero. Return pages freed into the buddy system. | ||
1346 | */ | ||
1347 | static inline unsigned long free_initmem_default(int poison) | ||
1348 | { | ||
1349 | extern char __init_begin[], __init_end[]; | ||
1350 | |||
1351 | return free_reserved_area(PAGE_ALIGN((unsigned long)&__init_begin) , | ||
1352 | ((unsigned long)&__init_end) & PAGE_MASK, | ||
1353 | poison, "unused kernel"); | ||
1354 | } | ||
1355 | |||
1298 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP | 1356 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
1299 | /* | 1357 | /* |
1300 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its | 1358 | * With CONFIG_HAVE_MEMBLOCK_NODE_MAP set, an architecture may initialise its |
@@ -1612,6 +1670,8 @@ int vm_insert_pfn(struct vm_area_struct *vma, unsigned long addr, | |||
1612 | unsigned long pfn); | 1670 | unsigned long pfn); |
1613 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, | 1671 | int vm_insert_mixed(struct vm_area_struct *vma, unsigned long addr, |
1614 | unsigned long pfn); | 1672 | unsigned long pfn); |
1673 | int vm_iomap_memory(struct vm_area_struct *vma, phys_addr_t start, unsigned long len); | ||
1674 | |||
1615 | 1675 | ||
1616 | struct page *follow_page_mask(struct vm_area_struct *vma, | 1676 | struct page *follow_page_mask(struct vm_area_struct *vma, |
1617 | unsigned long address, unsigned int foll_flags, | 1677 | unsigned long address, unsigned int foll_flags, |
@@ -1674,8 +1734,12 @@ int in_gate_area_no_mm(unsigned long addr); | |||
1674 | #define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) | 1734 | #define in_gate_area(mm, addr) ({(void)mm; in_gate_area_no_mm(addr);}) |
1675 | #endif /* __HAVE_ARCH_GATE_AREA */ | 1735 | #endif /* __HAVE_ARCH_GATE_AREA */ |
1676 | 1736 | ||
1737 | #ifdef CONFIG_SYSCTL | ||
1738 | extern int sysctl_drop_caches; | ||
1677 | int drop_caches_sysctl_handler(struct ctl_table *, int, | 1739 | int drop_caches_sysctl_handler(struct ctl_table *, int, |
1678 | void __user *, size_t *, loff_t *); | 1740 | void __user *, size_t *, loff_t *); |
1741 | #endif | ||
1742 | |||
1679 | unsigned long shrink_slab(struct shrink_control *shrink, | 1743 | unsigned long shrink_slab(struct shrink_control *shrink, |
1680 | unsigned long nr_pages_scanned, | 1744 | unsigned long nr_pages_scanned, |
1681 | unsigned long lru_pages); | 1745 | unsigned long lru_pages); |
@@ -1703,12 +1767,12 @@ pte_t *vmemmap_pte_populate(pmd_t *pmd, unsigned long addr, int node); | |||
1703 | void *vmemmap_alloc_block(unsigned long size, int node); | 1767 | void *vmemmap_alloc_block(unsigned long size, int node); |
1704 | void *vmemmap_alloc_block_buf(unsigned long size, int node); | 1768 | void *vmemmap_alloc_block_buf(unsigned long size, int node); |
1705 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); | 1769 | void vmemmap_verify(pte_t *, int, unsigned long, unsigned long); |
1706 | int vmemmap_populate_basepages(struct page *start_page, | 1770 | int vmemmap_populate_basepages(unsigned long start, unsigned long end, |
1707 | unsigned long pages, int node); | 1771 | int node); |
1708 | int vmemmap_populate(struct page *start_page, unsigned long pages, int node); | 1772 | int vmemmap_populate(unsigned long start, unsigned long end, int node); |
1709 | void vmemmap_populate_print_last(void); | 1773 | void vmemmap_populate_print_last(void); |
1710 | #ifdef CONFIG_MEMORY_HOTPLUG | 1774 | #ifdef CONFIG_MEMORY_HOTPLUG |
1711 | void vmemmap_free(struct page *memmap, unsigned long nr_pages); | 1775 | void vmemmap_free(unsigned long start, unsigned long end); |
1712 | #endif | 1776 | #endif |
1713 | void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, | 1777 | void register_page_bootmem_memmap(unsigned long section_nr, struct page *map, |
1714 | unsigned long size); | 1778 | unsigned long size); |
@@ -1755,5 +1819,11 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; } | |||
1755 | static inline bool page_is_guard(struct page *page) { return false; } | 1819 | static inline bool page_is_guard(struct page *page) { return false; } |
1756 | #endif /* CONFIG_DEBUG_PAGEALLOC */ | 1820 | #endif /* CONFIG_DEBUG_PAGEALLOC */ |
1757 | 1821 | ||
1822 | #if MAX_NUMNODES > 1 | ||
1823 | void __init setup_nr_node_ids(void); | ||
1824 | #else | ||
1825 | static inline void setup_nr_node_ids(void) {} | ||
1826 | #endif | ||
1827 | |||
1758 | #endif /* __KERNEL__ */ | 1828 | #endif /* __KERNEL__ */ |
1759 | #endif /* _LINUX_MM_H */ | 1829 | #endif /* _LINUX_MM_H */ |