Merge misc updates from Andrew Morton: - a few misc things - the rest of MM - remove flex_arrays, replace with new simple radix-tree implementation * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (38 commits) Drop flex_arrays sctp: convert to genradix proc: commit to genradix generic radix trees selinux: convert to kvmalloc md: convert to kvmalloc openvswitch: convert to kvmalloc of: fix kmemleak crash caused by imbalance in early memory reservation mm: memblock: update comments and kernel-doc memblock: split checks whether a region should be skipped to a helper function memblock: remove memblock_{set,clear}_region_flags memblock: drop memblock_alloc_*_nopanic() variants memblock: memblock_alloc_try_nid: don't panic treewide: add checks for the return value of memblock_alloc*() swiotlb: add checks for the return value of memblock_alloc*() init/main: add checks for the return value of memblock_alloc*() mm/percpu: add checks for the return value of memblock_alloc*() sparc: add checks for the return value of memblock_alloc*() ia64: add checks for the return value of memblock_alloc*() arch: don't memset(0) memory returned by memblock_alloc() ...
Showing the changes to include/linux (6 of 159 files). Show all
Unified · Split
| @@ -1,149 +0,0 @@ | ||
| 1 | −/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | −#ifndef _FLEX_ARRAY_H | |
| 3 | −#define _FLEX_ARRAY_H | |
| 4 | − | |
| 5 | −#include <linux/types.h> | |
| 6 | −#include <linux/reciprocal_div.h> | |
| 7 | −#include <asm/page.h> | |
| 8 | − | |
| 9 | −#define FLEX_ARRAY_PART_SIZE PAGE_SIZE | |
| 10 | −#define FLEX_ARRAY_BASE_SIZE PAGE_SIZE | |
| 11 | − | |
| 12 | −struct flex_array_part; | |
| 13 | − | |
| 14 | −/* | |
| 15 | − * This is meant to replace cases where an array-like | |
| 16 | − * structure has gotten too big to fit into kmalloc() | |
| 17 | − * and the developer is getting tempted to use | |
| 18 | − * vmalloc(). | |
| 19 | − */ | |
| 20 | − | |
| 21 | −struct flex_array { | |
| 22 | − union { | |
| 23 | − struct { | |
| 24 | − int element_size; | |
| 25 | − int total_nr_elements; | |
| 26 | − int elems_per_part; | |
| 27 | − struct reciprocal_value reciprocal_elems; | |
| 28 | − struct flex_array_part *parts[]; | |
| 29 | − }; | |
| 30 | − /* | |
| 31 | − * This little trick makes sure that | |
| 32 | − * sizeof(flex_array) == PAGE_SIZE | |
| 33 | − */ | |
| 34 | − char padding[FLEX_ARRAY_BASE_SIZE]; | |
| 35 | − }; | |
| 36 | −}; | |
| 37 | − | |
| 38 | −/* Number of bytes left in base struct flex_array, excluding metadata */ | |
| 39 | −#define FLEX_ARRAY_BASE_BYTES_LEFT \ | |
| 40 | − (FLEX_ARRAY_BASE_SIZE - offsetof(struct flex_array, parts)) | |
| 41 | − | |
| 42 | −/* Number of pointers in base to struct flex_array_part pages */ | |
| 43 | −#define FLEX_ARRAY_NR_BASE_PTRS \ | |
| 44 | − (FLEX_ARRAY_BASE_BYTES_LEFT / sizeof(struct flex_array_part *)) | |
| 45 | − | |
| 46 | −/* Number of elements of size that fit in struct flex_array_part */ | |
| 47 | −#define FLEX_ARRAY_ELEMENTS_PER_PART(size) \ | |
| 48 | − (FLEX_ARRAY_PART_SIZE / size) | |
| 49 | − | |
| 50 | −/* | |
| 51 | − * Defines a statically allocated flex array and ensures its parameters are | |
| 52 | − * valid. | |
| 53 | − */ | |
| 54 | −#define DEFINE_FLEX_ARRAY(__arrayname, __element_size, __total) \ | |
| 55 | − struct flex_array __arrayname = { { { \ | |
| 56 | − .element_size = (__element_size), \ | |
| 57 | − .total_nr_elements = (__total), \ | |
| 58 | − } } }; \ | |
| 59 | − static inline void __arrayname##_invalid_parameter(void) \ | |
| 60 | − { \ | |
| 61 | − BUILD_BUG_ON((__total) > FLEX_ARRAY_NR_BASE_PTRS * \ | |
| 62 | − FLEX_ARRAY_ELEMENTS_PER_PART(__element_size)); \ | |
| 63 | − } | |
| 64 | − | |
| 65 | −/** | |
| 66 | − * flex_array_alloc() - Creates a flexible array. | |
| 67 | − * @element_size: individual object size. | |
| 68 | − * @total: maximum number of objects which can be stored. | |
| 69 | − * @flags: GFP flags | |
| 70 | − * | |
| 71 | − * Return: Returns an object of structure flex_array. | |
| 72 | − */ | |
| 73 | −struct flex_array *flex_array_alloc(int element_size, unsigned int total, | |
| 74 | − gfp_t flags); | |
| 75 | − | |
| 76 | −/** | |
| 77 | − * flex_array_prealloc() - Ensures that memory for the elements indexed in the | |
| 78 | − * range defined by start and nr_elements has been allocated. | |
| 79 | − * @fa: array to allocate memory to. | |
| 80 | − * @start: start address | |
| 81 | − * @nr_elements: number of elements to be allocated. | |
| 82 | − * @flags: GFP flags | |
| 83 | − * | |
| 84 | − */ | |
| 85 | −int flex_array_prealloc(struct flex_array *fa, unsigned int start, | |
| 86 | − unsigned int nr_elements, gfp_t flags); | |
| 87 | − | |
| 88 | −/** | |
| 89 | − * flex_array_free() - Removes all elements of a flexible array. | |
| 90 | − * @fa: array to be freed. | |
| 91 | − */ | |
| 92 | −void flex_array_free(struct flex_array *fa); | |
| 93 | − | |
| 94 | −/** | |
| 95 | − * flex_array_free_parts() - Removes all elements of a flexible array, but | |
| 96 | − * leaves the array itself in place. | |
| 97 | − * @fa: array to be emptied. | |
| 98 | − */ | |
| 99 | −void flex_array_free_parts(struct flex_array *fa); | |
| 100 | − | |
| 101 | −/** | |
| 102 | − * flex_array_put() - Stores data into a flexible array. | |
| 103 | − * @fa: array where element is to be stored. | |
| 104 | − * @element_nr: position to copy, must be less than the maximum specified when | |
| 105 | − * the array was created. | |
| 106 | − * @src: data source to be copied into the array. | |
| 107 | − * @flags: GFP flags | |
| 108 | − * | |
| 109 | − * Return: Returns zero on success, a negative error code otherwise. | |
| 110 | − */ | |
| 111 | −int flex_array_put(struct flex_array *fa, unsigned int element_nr, void *src, | |
| 112 | − gfp_t flags); | |
| 113 | − | |
| 114 | −/** | |
| 115 | − * flex_array_clear() - Clears an individual element in the array, sets the | |
| 116 | − * given element to FLEX_ARRAY_FREE. | |
| 117 | − * @element_nr: element position to clear. | |
| 118 | − * @fa: array to which element to be cleared belongs. | |
| 119 | − * | |
| 120 | − * Return: Returns zero on success, -EINVAL otherwise. | |
| 121 | − */ | |
| 122 | −int flex_array_clear(struct flex_array *fa, unsigned int element_nr); | |
| 123 | − | |
| 124 | −/** | |
| 125 | − * flex_array_get() - Retrieves data into a flexible array. | |
| 126 | − * | |
| 127 | − * @element_nr: Element position to retrieve data from. | |
| 128 | − * @fa: array from which data is to be retrieved. | |
| 129 | − * | |
| 130 | − * Return: Returns a pointer to the data element, or NULL if that | |
| 131 | − * particular element has never been allocated. | |
| 132 | − */ | |
| 133 | −void *flex_array_get(struct flex_array *fa, unsigned int element_nr); | |
| 134 | − | |
| 135 | −/** | |
| 136 | − * flex_array_shrink() - Reduces the allocated size of an array. | |
| 137 | − * @fa: array to shrink. | |
| 138 | − * | |
| 139 | − * Return: Returns number of pages of memory actually freed. | |
| 140 | − * | |
| 141 | − */ | |
| 142 | −int flex_array_shrink(struct flex_array *fa); | |
| 143 | − | |
| 144 | −#define flex_array_put_ptr(fa, nr, src, gfp) \ | |
| 145 | − flex_array_put(fa, nr, (void *)&(src), gfp) | |
| 146 | − | |
| 147 | −void *flex_array_get_ptr(struct flex_array *fa, unsigned int element_nr); | |
| 148 | − | |
| 149 | −#endif /* _FLEX_ARRAY_H */ | |
| @@ -0,0 +1,231 @@ | ||
| 1 | +#ifndef _LINUX_GENERIC_RADIX_TREE_H | |
| 2 | +#define _LINUX_GENERIC_RADIX_TREE_H | |
| 3 | + | |
| 4 | +/** | |
| 5 | + * DOC: Generic radix trees/sparse arrays: | |
| 6 | + * | |
| 7 | + * Very simple and minimalistic, supporting arbitrary size entries up to | |
| 8 | + * PAGE_SIZE. | |
| 9 | + * | |
| 10 | + * A genradix is defined with the type it will store, like so: | |
| 11 | + * | |
| 12 | + * static GENRADIX(struct foo) foo_genradix; | |
| 13 | + * | |
| 14 | + * The main operations are: | |
| 15 | + * | |
| 16 | + * - genradix_init(radix) - initialize an empty genradix | |
| 17 | + * | |
| 18 | + * - genradix_free(radix) - free all memory owned by the genradix and | |
| 19 | + * reinitialize it | |
| 20 | + * | |
| 21 | + * - genradix_ptr(radix, idx) - gets a pointer to the entry at idx, returning | |
| 22 | + * NULL if that entry does not exist | |
| 23 | + * | |
| 24 | + * - genradix_ptr_alloc(radix, idx, gfp) - gets a pointer to an entry, | |
| 25 | + * allocating it if necessary | |
| 26 | + * | |
| 27 | + * - genradix_for_each(radix, iter, p) - iterate over each entry in a genradix | |
| 28 | + * | |
| 29 | + * The radix tree allocates one page of entries at a time, so entries may exist | |
| 30 | + * that were never explicitly allocated - they will be initialized to all | |
| 31 | + * zeroes. | |
| 32 | + * | |
| 33 | + * Internally, a genradix is just a radix tree of pages, and indexing works in | |
| 34 | + * terms of byte offsets. The wrappers in this header file use sizeof on the | |
| 35 | + * type the radix contains to calculate a byte offset from the index - see | |
| 36 | + * __idx_to_offset. | |
| 37 | + */ | |
| 38 | + | |
| 39 | +#include <asm/page.h> | |
| 40 | +#include <linux/bug.h> | |
| 41 | +#include <linux/kernel.h> | |
| 42 | +#include <linux/log2.h> | |
| 43 | + | |
| 44 | +struct genradix_root; | |
| 45 | + | |
| 46 | +struct __genradix { | |
| 47 | + struct genradix_root __rcu *root; | |
| 48 | +}; | |
| 49 | + | |
| 50 | +/* | |
| 51 | + * NOTE: currently, sizeof(_type) must not be larger than PAGE_SIZE: | |
| 52 | + */ | |
| 53 | + | |
| 54 | +#define __GENRADIX_INITIALIZER \ | |
| 55 | + { \ | |
| 56 | + .tree = { \ | |
| 57 | + .root = NULL, \ | |
| 58 | + } \ | |
| 59 | + } | |
| 60 | + | |
| 61 | +/* | |
| 62 | + * We use a 0 size array to stash the type we're storing without taking any | |
| 63 | + * space at runtime - then the various accessor macros can use typeof() to get | |
| 64 | + * to it for casts/sizeof - we also force the alignment so that storing a type | |
| 65 | + * with a ridiculous alignment doesn't blow up the alignment or size of the | |
| 66 | + * genradix. | |
| 67 | + */ | |
| 68 | + | |
| 69 | +#define GENRADIX(_type) \ | |
| 70 | +struct { \ | |
| 71 | + struct __genradix tree; \ | |
| 72 | + _type type[0] __aligned(1); \ | |
| 73 | +} | |
| 74 | + | |
| 75 | +#define DEFINE_GENRADIX(_name, _type) \ | |
| 76 | + GENRADIX(_type) _name = __GENRADIX_INITIALIZER | |
| 77 | + | |
| 78 | +/** | |
| 79 | + * genradix_init - initialize a genradix | |
| 80 | + * @_radix: genradix to initialize | |
| 81 | + * | |
| 82 | + * Does not fail | |
| 83 | + */ | |
| 84 | +#define genradix_init(_radix) \ | |
| 85 | +do { \ | |
| 86 | + *(_radix) = (typeof(*_radix)) __GENRADIX_INITIALIZER; \ | |
| 87 | +} while (0) | |
| 88 | + | |
| 89 | +void __genradix_free(struct __genradix *); | |
| 90 | + | |
| 91 | +/** | |
| 92 | + * genradix_free: free all memory owned by a genradix | |
| 93 | + * @_radix: the genradix to free | |
| 94 | + * | |
| 95 | + * After freeing, @_radix will be reinitialized and empty | |
| 96 | + */ | |
| 97 | +#define genradix_free(_radix) __genradix_free(&(_radix)->tree) | |
| 98 | + | |
| 99 | +static inline size_t __idx_to_offset(size_t idx, size_t obj_size) | |
| 100 | +{ | |
| 101 | + if (__builtin_constant_p(obj_size)) | |
| 102 | + BUILD_BUG_ON(obj_size > PAGE_SIZE); | |
| 103 | + else | |
| 104 | + BUG_ON(obj_size > PAGE_SIZE); | |
| 105 | + | |
| 106 | + if (!is_power_of_2(obj_size)) { | |
| 107 | + size_t objs_per_page = PAGE_SIZE / obj_size; | |
| 108 | + | |
| 109 | + return (idx / objs_per_page) * PAGE_SIZE + | |
| 110 | + (idx % objs_per_page) * obj_size; | |
| 111 | + } else { | |
| 112 | + return idx * obj_size; | |
| 113 | + } | |
| 114 | +} | |
| 115 | + | |
| 116 | +#define __genradix_cast(_radix) (typeof((_radix)->type[0]) *) | |
| 117 | +#define __genradix_obj_size(_radix) sizeof((_radix)->type[0]) | |
| 118 | +#define __genradix_idx_to_offset(_radix, _idx) \ | |
| 119 | + __idx_to_offset(_idx, __genradix_obj_size(_radix)) | |
| 120 | + | |
| 121 | +void *__genradix_ptr(struct __genradix *, size_t); | |
| 122 | + | |
| 123 | +/** | |
| 124 | + * genradix_ptr - get a pointer to a genradix entry | |
| 125 | + * @_radix: genradix to access | |
| 126 | + * @_idx: index to fetch | |
| 127 | + * | |
| 128 | + * Returns a pointer to entry at @_idx, or NULL if that entry does not exist. | |
| 129 | + */ | |
| 130 | +#define genradix_ptr(_radix, _idx) \ | |
| 131 | + (__genradix_cast(_radix) \ | |
| 132 | + __genradix_ptr(&(_radix)->tree, \ | |
| 133 | + __genradix_idx_to_offset(_radix, _idx))) | |
| 134 | + | |
| 135 | +void *__genradix_ptr_alloc(struct __genradix *, size_t, gfp_t); | |
| 136 | + | |
| 137 | +/** | |
| 138 | + * genradix_ptr_alloc - get a pointer to a genradix entry, allocating it | |
| 139 | + * if necessary | |
| 140 | + * @_radix: genradix to access | |
| 141 | + * @_idx: index to fetch | |
| 142 | + * @_gfp: gfp mask | |
| 143 | + * | |
| 144 | + * Returns a pointer to entry at @_idx, or NULL on allocation failure | |
| 145 | + */ | |
| 146 | +#define genradix_ptr_alloc(_radix, _idx, _gfp) \ | |
| 147 | + (__genradix_cast(_radix) \ | |
| 148 | + __genradix_ptr_alloc(&(_radix)->tree, \ | |
| 149 | + __genradix_idx_to_offset(_radix, _idx), \ | |
| 150 | + _gfp)) | |
| 151 | + | |
| 152 | +struct genradix_iter { | |
| 153 | + size_t offset; | |
| 154 | + size_t pos; | |
| 155 | +}; | |
| 156 | + | |
| 157 | +/** | |
| 158 | + * genradix_iter_init - initialize a genradix_iter | |
| 159 | + * @_radix: genradix that will be iterated over | |
| 160 | + * @_idx: index to start iterating from | |
| 161 | + */ | |
| 162 | +#define genradix_iter_init(_radix, _idx) \ | |
| 163 | + ((struct genradix_iter) { \ | |
| 164 | + .pos = (_idx), \ | |
| 165 | + .offset = __genradix_idx_to_offset((_radix), (_idx)),\ | |
| 166 | + }) | |
| 167 | + | |
| 168 | +void *__genradix_iter_peek(struct genradix_iter *, struct __genradix *, size_t); | |
| 169 | + | |
| 170 | +/** | |
| 171 | + * genradix_iter_peek - get first entry at or above iterator's current | |
| 172 | + * position | |
| 173 | + * @_iter: a genradix_iter | |
| 174 | + * @_radix: genradix being iterated over | |
| 175 | + * | |
| 176 | + * If no more entries exist at or above @_iter's current position, returns NULL | |
| 177 | + */ | |
| 178 | +#define genradix_iter_peek(_iter, _radix) \ | |
| 179 | + (__genradix_cast(_radix) \ | |
| 180 | + __genradix_iter_peek(_iter, &(_radix)->tree, \ | |
| 181 | + PAGE_SIZE / __genradix_obj_size(_radix))) | |
| 182 | + | |
| 183 | +static inline void __genradix_iter_advance(struct genradix_iter *iter, | |
| 184 | + size_t obj_size) | |
| 185 | +{ | |
| 186 | + iter->offset += obj_size; | |
| 187 | + | |
| 188 | + if (!is_power_of_2(obj_size) && | |
| 189 | + (iter->offset & (PAGE_SIZE - 1)) + obj_size > PAGE_SIZE) | |
| 190 | + iter->offset = round_up(iter->offset, PAGE_SIZE); | |
| 191 | + | |
| 192 | + iter->pos++; | |
| 193 | +} | |
| 194 | + | |
| 195 | +#define genradix_iter_advance(_iter, _radix) \ | |
| 196 | + __genradix_iter_advance(_iter, __genradix_obj_size(_radix)) | |
| 197 | + | |
| 198 | +#define genradix_for_each_from(_radix, _iter, _p, _start) \ | |
| 199 | + for (_iter = genradix_iter_init(_radix, _start); \ | |
| 200 | + (_p = genradix_iter_peek(&_iter, _radix)) != NULL; \ | |
| 201 | + genradix_iter_advance(&_iter, _radix)) | |
| 202 | + | |
| 203 | +/** | |
| 204 | + * genradix_for_each - iterate over entry in a genradix | |
| 205 | + * @_radix: genradix to iterate over | |
| 206 | + * @_iter: a genradix_iter to track current position | |
| 207 | + * @_p: pointer to genradix entry type | |
| 208 | + * | |
| 209 | + * On every iteration, @_p will point to the current entry, and @_iter.pos | |
| 210 | + * will be the current entry's index. | |
| 211 | + */ | |
| 212 | +#define genradix_for_each(_radix, _iter, _p) \ | |
| 213 | + genradix_for_each_from(_radix, _iter, _p, 0) | |
| 214 | + | |
| 215 | +int __genradix_prealloc(struct __genradix *, size_t, gfp_t); | |
| 216 | + | |
| 217 | +/** | |
| 218 | + * genradix_prealloc - preallocate entries in a generic radix tree | |
| 219 | + * @_radix: genradix to preallocate | |
| 220 | + * @_nr: number of entries to preallocate | |
| 221 | + * @_gfp: gfp mask | |
| 222 | + * | |
| 223 | + * Returns 0 on success, -ENOMEM on failure | |
| 224 | + */ | |
| 225 | +#define genradix_prealloc(_radix, _nr, _gfp) \ | |
| 226 | + __genradix_prealloc(&(_radix)->tree, \ | |
| 227 | + __genradix_idx_to_offset(_radix, _nr + 1),\ | |
| 228 | + _gfp) | |
| 229 | + | |
| 230 | + | |
| 231 | +#endif /* _LINUX_GENERIC_RADIX_TREE_H */ | |
| @@ -468,7 +468,7 @@ struct hmm_devmem_ops { · 467 unmodified lines | ||
| 468 | 468 | * Note that mmap semaphore is held in read mode at least when this |
| 469 | 469 | * callback occurs, hence the vma is valid upon callback entry. |
| 470 | 470 | */ |
| 471 | − int (*fault)(struct hmm_devmem *devmem, | |
| 471 | + vm_fault_t (*fault)(struct hmm_devmem *devmem, | |
| 472 | 472 | struct vm_area_struct *vma, |
| 473 | 473 | unsigned long addr, |
| 474 | 474 | const struct page *page, |
| @@ -511,7 +511,7 @@ struct hmm_devmem_ops { · 36 unmodified lines | ||
| 511 | 511 | * chunk, as an optimization. It must, however, prioritize the faulting address |
| 512 | 512 | * over all the others. |
| 513 | 513 | */ |
| 514 | −typedef int (*dev_page_fault_t)(struct vm_area_struct *vma, | |
| 514 | +typedef vm_fault_t (*dev_page_fault_t)(struct vm_area_struct *vma, | |
| 515 | 515 | unsigned long addr, |
| 516 | 516 | const struct page *page, |
| 517 | 517 | unsigned int flags, |
| @@ -108,9 +108,6 @@ void memblock_discard(void); · 107 unmodified lines | ||
| 108 | 108 | #define memblock_dbg(fmt, ...) \ |
| 109 | 109 | if (memblock_debug) printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) |
| 110 | 110 | |
| 111 | −phys_addr_t memblock_find_in_range_node(phys_addr_t size, phys_addr_t align, | |
| 112 | − phys_addr_t start, phys_addr_t end, | |
| 113 | − int nid, enum memblock_flags flags); | |
| 114 | 111 | phys_addr_t memblock_find_in_range(phys_addr_t start, phys_addr_t end, |
| 115 | 112 | phys_addr_t size, phys_addr_t align); |
| 116 | 113 | void memblock_allow_resize(void); |
| @@ -127,7 +124,6 @@ int memblock_clear_hotplug(phys_addr_t base, phys_addr_t size); · 10 unmodified lines | ||
| 127 | 124 | int memblock_mark_mirror(phys_addr_t base, phys_addr_t size); |
| 128 | 125 | int memblock_mark_nomap(phys_addr_t base, phys_addr_t size); |
| 129 | 126 | int memblock_clear_nomap(phys_addr_t base, phys_addr_t size); |
| 130 | −enum memblock_flags choose_memblock_flags(void); | |
| 131 | 127 | |
| 132 | 128 | unsigned long memblock_free_all(void); |
| 133 | 129 | void reset_node_managed_pages(pg_data_t *pgdat); |
| @@ -277,18 +273,6 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, · 143 unmodified lines | ||
| 277 | 273 | for_each_mem_range_rev(i, &memblock.memory, &memblock.reserved, \ |
| 278 | 274 | nid, flags, p_start, p_end, p_nid) |
| 279 | 275 | |
| 280 | −static inline void memblock_set_region_flags(struct memblock_region *r, | |
| 281 | − enum memblock_flags flags) | |
| 282 | −{ | |
| 283 | − r->flags |= flags; | |
| 284 | −} | |
| 285 | − | |
| 286 | −static inline void memblock_clear_region_flags(struct memblock_region *r, | |
| 287 | − enum memblock_flags flags) | |
| 288 | −{ | |
| 289 | − r->flags &= ~flags; | |
| 290 | −} | |
| 291 | − | |
| 292 | 276 | #ifdef CONFIG_HAVE_MEMBLOCK_NODE_MAP |
| 293 | 277 | int memblock_set_node(phys_addr_t base, phys_addr_t size, |
| 294 | 278 | struct memblock_type *type, int nid); |
| @@ -325,17 +309,20 @@ static inline int memblock_get_region_node(const struct memblock_region *r) · 30 unmodified lines | ||
| 325 | 309 | #define ARCH_LOW_ADDRESS_LIMIT 0xffffffffUL |
| 326 | 310 | #endif |
| 327 | 311 | |
| 328 | −phys_addr_t memblock_phys_alloc_nid(phys_addr_t size, phys_addr_t align, int nid); | |
| 312 | +phys_addr_t memblock_phys_alloc_range(phys_addr_t size, phys_addr_t align, | |
| 313 | + phys_addr_t start, phys_addr_t end); | |
| 329 | 314 | phys_addr_t memblock_phys_alloc_try_nid(phys_addr_t size, phys_addr_t align, int nid); |
| 330 | 315 | |
| 331 | −phys_addr_t memblock_phys_alloc(phys_addr_t size, phys_addr_t align); | |
| 316 | +static inline phys_addr_t memblock_phys_alloc(phys_addr_t size, | |
| 317 | + phys_addr_t align) | |
| 318 | +{ | |
| 319 | + return memblock_phys_alloc_range(size, align, 0, | |
| 320 | + MEMBLOCK_ALLOC_ACCESSIBLE); | |
| 321 | +} | |
| 332 | 322 | |
| 333 | 323 | void *memblock_alloc_try_nid_raw(phys_addr_t size, phys_addr_t align, |
| 334 | 324 | phys_addr_t min_addr, phys_addr_t max_addr, |
| 335 | 325 | int nid); |
| 336 | −void *memblock_alloc_try_nid_nopanic(phys_addr_t size, phys_addr_t align, | |
| 337 | − phys_addr_t min_addr, phys_addr_t max_addr, | |
| 338 | − int nid); | |
| 339 | 326 | void *memblock_alloc_try_nid(phys_addr_t size, phys_addr_t align, |
| 340 | 327 | phys_addr_t min_addr, phys_addr_t max_addr, |
| 341 | 328 | int nid); |
| @@ -362,36 +349,12 @@ static inline void * __init memblock_alloc_from(phys_addr_t size, · 20 unmodified lines | ||
| 362 | 349 | MEMBLOCK_ALLOC_ACCESSIBLE, NUMA_NO_NODE); |
| 363 | 350 | } |
| 364 | 351 | |
| 365 | −static inline void * __init memblock_alloc_nopanic(phys_addr_t size, | |
| 366 | − phys_addr_t align) | |
| 367 | −{ | |
| 368 | − return memblock_alloc_try_nid_nopanic(size, align, MEMBLOCK_LOW_LIMIT, | |
| 369 | − MEMBLOCK_ALLOC_ACCESSIBLE, | |
| 370 | − NUMA_NO_NODE); | |
| 371 | −} | |
| 372 | − | |
| 373 | 352 | static inline void * __init memblock_alloc_low(phys_addr_t size, |
| 374 | 353 | phys_addr_t align) |
| 375 | 354 | { |
| 376 | 355 | return memblock_alloc_try_nid(size, align, MEMBLOCK_LOW_LIMIT, |
| 377 | 356 | ARCH_LOW_ADDRESS_LIMIT, NUMA_NO_NODE); |
| 378 | 357 | } |
| 379 | −static inline void * __init memblock_alloc_low_nopanic(phys_addr_t size, | |
| 380 | − phys_addr_t align) | |
| 381 | −{ | |
| 382 | − return memblock_alloc_try_nid_nopanic(size, align, MEMBLOCK_LOW_LIMIT, | |
| 383 | − ARCH_LOW_ADDRESS_LIMIT, | |
| 384 | − NUMA_NO_NODE); | |
| 385 | −} | |
| 386 | − | |
| 387 | −static inline void * __init memblock_alloc_from_nopanic(phys_addr_t size, | |
| 388 | − phys_addr_t align, | |
| 389 | − phys_addr_t min_addr) | |
| 390 | −{ | |
| 391 | − return memblock_alloc_try_nid_nopanic(size, align, min_addr, | |
| 392 | − MEMBLOCK_ALLOC_ACCESSIBLE, | |
| 393 | − NUMA_NO_NODE); | |
| 394 | −} | |
| 395 | 358 | |
| 396 | 359 | static inline void * __init memblock_alloc_node(phys_addr_t size, |
| 397 | 360 | phys_addr_t align, int nid) |
| @@ -400,14 +363,6 @@ static inline void * __init memblock_alloc_node(phys_addr_t size, · 2 unmodified lines | ||
| 400 | 363 | MEMBLOCK_ALLOC_ACCESSIBLE, nid); |
| 401 | 364 | } |
| 402 | 365 | |
| 403 | −static inline void * __init memblock_alloc_node_nopanic(phys_addr_t size, | |
| 404 | − int nid) | |
| 405 | −{ | |
| 406 | − return memblock_alloc_try_nid_nopanic(size, SMP_CACHE_BYTES, | |
| 407 | − MEMBLOCK_LOW_LIMIT, | |
| 408 | − MEMBLOCK_ALLOC_ACCESSIBLE, nid); | |
| 409 | −} | |
| 410 | − | |
| 411 | 366 | static inline void __init memblock_free_early(phys_addr_t base, |
| 412 | 367 | phys_addr_t size) |
| 413 | 368 | { |
| @@ -443,16 +398,6 @@ static inline bool memblock_bottom_up(void) · 29 unmodified lines | ||
| 443 | 398 | return memblock.bottom_up; |
| 444 | 399 | } |
| 445 | 400 | |
| 446 | −phys_addr_t __init memblock_alloc_range(phys_addr_t size, phys_addr_t align, | |
| 447 | − phys_addr_t start, phys_addr_t end, | |
| 448 | − enum memblock_flags flags); | |
| 449 | −phys_addr_t memblock_alloc_base_nid(phys_addr_t size, | |
| 450 | − phys_addr_t align, phys_addr_t max_addr, | |
| 451 | − int nid, enum memblock_flags flags); | |
| 452 | −phys_addr_t memblock_alloc_base(phys_addr_t size, phys_addr_t align, | |
| 453 | − phys_addr_t max_addr); | |
| 454 | −phys_addr_t __memblock_alloc_base(phys_addr_t size, phys_addr_t align, | |
| 455 | − phys_addr_t max_addr); | |
| 456 | 401 | phys_addr_t memblock_phys_mem_size(void); |
| 457 | 402 | phys_addr_t memblock_reserved_size(void); |
| 458 | 403 | phys_addr_t memblock_mem_size(unsigned long limit_pfn); |
| @@ -26,6 +26,7 @@ · 25 unmodified lines | ||
| 26 | 26 | #include <linux/page_ref.h> |
| 27 | 27 | #include <linux/memremap.h> |
| 28 | 28 | #include <linux/overflow.h> |
| 29 | +#include <linux/sizes.h> | |
| 29 | 30 | |
| 30 | 31 | struct mempolicy; |
| 31 | 32 | struct anon_vma; |
| @@ -2402,8 +2403,7 @@ int __must_check write_one_page(struct page *page); · 2370 unmodified lines | ||
| 2402 | 2403 | void task_dirty_inc(struct task_struct *tsk); |
| 2403 | 2404 | |
| 2404 | 2405 | /* readahead.c */ |
| 2405 | −#define VM_MAX_READAHEAD 128 /* kbytes */ | |
| 2406 | −#define VM_MIN_READAHEAD 16 /* kbytes (includes current page) */ | |
| 2406 | +#define VM_READAHEAD_PAGES (SZ_128K / PAGE_SIZE) | |
| 2407 | 2407 | |
| 2408 | 2408 | int force_page_cache_readahead(struct address_space *mapping, struct file *filp, |
| 2409 | 2409 | pgoff_t offset, unsigned long nr_to_read); |
| @@ -83,9 +83,6 @@ · 82 unmodified lines | ||
| 83 | 83 | #define MUTEX_DEBUG_FREE 0x22 |
| 84 | 84 | #define MUTEX_POISON_WW_CTX ((void *) 0x500 + POISON_POINTER_DELTA) |
| 85 | 85 | |
| 86 | −/********** lib/flex_array.c **********/ | |
| 87 | −#define FLEX_ARRAY_FREE 0x6c /* for use-after-free poisoning */ | |
| 88 | − | |
| 89 | 86 | /********** security/ **********/ |
| 90 | 87 | #define KEY_DESTROY 0xbd |
| 91 | 88 | |