> 32 /span v 32 /form v 32 a > 32 href="../linux+von>.6/mm/percpu.c"> > 32 img src="../.static/gfx/right.png" alt=">>"> /span v span class="lxr_search"> > > 32 input typ vahidden" nam vanavtarget" ti2n va"> > 32 input typ vatext" nam vasearch" idvasearch"> > 32 buttSearch 32 onclick="return ajax_prefs();"> > 32Prefsv 32 /a> /span v> 32 2 /div v> 32 2 form ac 2n="ajax+*" method="post" onsubmit="return false;"> input typ vahidden" nam vaajax_lookup" idvaajax_lookup" ti2n va"> > 32 2 /form v > 32 2 div class="headingbott
32 32 2 div idvasearch_results" class="search_results"v 3 v> 32 2 /div v div idvacontent">v div idvafile_contents"
2 21 /a> span class="comment">/* /span v2 22 /a> span class="comment"> * mm/percpu.c - percpu memory allocator /span v2 23 /a> span class="comment"> * /span v2 24 /a> span class="comment"> * Copyright (C) 2009           SUSE Linux2Products GmbH /span v2 25 /a> span class="comment"> * Copyright (C) 2009           Tejun Heo <> /span v2 26 /a> span class="comment"> * /span v2 27 /a> span class="comment"> * This file is released under the GPL.2. /span v2 28 /a> span class="comment"> * /span v2 29 /a> span class="comment"> * This is percpu allocator which can handle both static and dynamic /span v2 ptioa> span class="comment"> * areas.32Percpu areas are allocated in chunks.32Each chunk is /span v2 11 /a> span class="comment"> * consisted of boot-time determined number of units and the first /span v2 12 /a> span class="comment"> * chunk is used for static percpu variables in the kernel image /span v2 13 /a> span class="comment"> * (special boot time alloc/init handling necessary as these areas /span v2 14 /a> span class="comment"> * need to be brought up before allocat 2 15 /a> span class="comment"> * Unit grows as necessary and all units grow or shrink in unison. /span v2 16 /a> span class="comment"> * When a chunk is filled up, another chunk is allocated. /span v2 17 /a> span class="comment"> * /span v2 18 /a> span class="comment"> *  c0                           c1                         c2 /span v2 19 /a> span class="comment"> *  -------------------          -------------------        ------------ /span v2 2tioa> span class="comment"> * | u0 | u1 | u2 | u3 |        | u0 | u1 | u2 | u3 |      | u0 | u1 | u /span v2 21 /a> span class="comment"> *  -------------------  ......  -------------------  ....  ------------ /span v2 22 /a> span class="comment"> * /span v2 23 /a> span class="comment"> * Allocat 2 24 /a> span class="comment"> * an area of 512 bytes at 6k in c1 occupies 512 bytes at 6k of c1:u0, /span v2 25 /a> span class="comment"> * c1:u1, c1:u2 and c1:u3.  On UMA, units corresponds directly to /span v2 26 /a> span class="comment"> * cpus.  On NUMA, the mapping can be non-linear and even sparse. /span v2 27 /a> span class="comment"> * Percpu access can be done by configuring percpu base registers /span v2 28 /a> span class="comment"> * according to cpu to unit mapping and pcpu_unit_size. /span v2 29 /a> span class="comment"> * /span v2 3tioa> span class="comment"> * There are usually many small percpu allocat 2 31 /a> span class="comment"> * as small as 4 bytes.  The allocator organizes chunks into lists /span v2 32 /a> span class="comment"> * according to free size and tries to allocate from the fullest one. /span v2 33 /a> span class="comment"> * Each chunk keeps the maximum contiguous area size hint which is /span v2 34 /a> span class="comment"> * guaranteed to be equal to or larger than the maximum contiguous /span v2 35 /a> span class="comment"> * area in the chunk.  This helps the allocator not to iterate the /span v2 36 /a> span class="comment"> * chunk maps unnecessarily. /span v2 37 /a> span class="comment"> * /span v2 38 /a> span class="comment"> * Allocat 2 39 /a> span class="comment"> * on chunk->map.  A positive ti2n  in the map represents a free /span v2 4tioa> span class="comment"> * region and negative allocated.  Allocat 2 41 /a> span class="comment"> * by scanning this map sequentially and serving the first matching /span v2 42 /a> span class="comment"> * entry.  This is mostly copied from the percpu_modalloc() allocator. /span v2 43 /a> span class="comment"> * Chunks can be determined from the address using the index field /span v2 44 /a> span class="comment"> * in the page struct. The index field contains a pointer to the chunk. /span v2 45 /a> span class="comment"> * /span v2 46 /a> span class="comment"> * To use this allocator, arch code should do the followings. /span v2 47 /a> span class="comment"> * /span v2 48 /a> span class="comment"> * - define __addr_to_pcpu_ptr() and __pcpu_ptr_to_addr() to translate /span v2 49 /a> span class="comment"> *   regular address to percpu pointer and back if they need to be /span v2 5tioa> span class="comment"> *   different from the default /span v2 51 /a> span class="comment"> * /span v2 52 /a> span class="comment"> * - use pcpu_setup_first_chunk() during percpu area initializat 2 53 /a> span class="comment"> *   setup the first chunk containing the kernel static percpu area /span v2 54 /a> span class="comment"> */ /span v2 55 /a>v2 56 /a>#include <linux/bitmap.h /a>>v2 57 /a>#include <linux/bootmem.h /a>>v2 58 /a>#include <linux/err.h /a>>v2 59 /a>#include <linux/list.h /a>>v2 60 /a>#include <linux/log2.h /a>>v2 61 /a>#include <linux/mm.h /a>>v2 62 /a>#include <linux/module.h /a>>v2 63 /a>#include <linux/mutex.h /a>>v2 64 /a>#include <linux/percpu.h /a>>v2 65 /a>#include <linux/pfn.h /a>>v2 66 /a>#include <linux/slab.h /a>>v2 67 /a>#include <linux/spinlock.h /a>>v2 68 /a>#include <linux/vmalloc.h /a>>v2 69 /a>#include <linux/workqueue.h /a>>v2 70 /a>#include <linux/kmemleak.h /a>>v2 71 /a>v2 72 /a>#include <asm/cacheflush.h /a>>v2 73 /a>#include <asm/sec
 2ns.h /a>>v2 74 /a>#include <asm/tlbflush.h /a>>v2 75 /a>#include <asm/io.h /a>>v2 76 /a>v2 77 /a>#define PCPU_SLOT_BASE_SHIFT /a>            5        span class="comment">/* 1-31 shares the sam  slot */ /span v2 78 /a>#define PCPU_DFL_MAP_ALLOC /a>            2 16       span class="comment">/* start a map with 16 ents */ /span v2 79 /a>v2 80 /a>#ifdef CONFIG_SMP /a>v2 81 /a> span class="comment">/* default addr <-> pcpu_ptr mapping, override in asm/percpu.h if necessary */ /span v2 82 /a>#ifndef __addr_to_pcpu_ptr /a>v2 83 /a>#define __addr_to_pcpu_ptr /a>(addr /a>)                                        \v2 84 /a>        (void __percpu /a> *)((unsigned long)(addr /a>) -                       \v2 85 /a>            2             (unsigned long)pcpu_base_addr /a> +               \v2 86 /a>            2             (unsigned long)__per_cpu_start /a>)v2 87 /a>#endifv2 88 /a>#ifndef __pcpu_ptr_to_addr /a>v2 89 /a>#define __pcpu_ptr_to_addr /a>(ptr /a>)                                         \v2 90 /a>        (void __force /a> *)((unsigned long)(ptr /a>) +                         \v2 91 /a>            2            (unsigned long)pcpu_base_addr /a> -                \v2 92 /a>            2            (unsigned long)__per_cpu_start /a>)v2 93 /a>#endifv2 94 /a>#else    span class="comment">/* CONFIG_SMP */ /span v2 95 /a> span class="comment">/* on UP, it's always identity mapped */ /span v2 96 /a>#define __addr_to_pcpu_ptr /a>(addr /a>)        (void __percpu /a> *)(addr /a>)v2 97 /a>#define __pcpu_ptr_to_addr /a>(ptr /a>)         (void __force /a> *)(ptr /a>)v2 98 /a>#endif   span class="comment">/* CONFIG_SMP */ /span v2 99 /a>v2100 /a>struct pcpu_chunk /a> {v2101 /a>        struct list_head /a>        list /a>;            span class="comment">/* linked to pcpu_slot lists */ /span v2102 /a>        int                     free_size /a>;       span class="comment">/* free bytes in the chunk */ /span v2103 /a>        int                     contig_hint /a>;     span class="comment">/* max contiguous size hint */ /span v2104 /a>        void                    *base_addr /a>;      span class="comment">/* base address of this chunk */ /span v2105 /a>        int                     map_used /a>;        span class="comment">/* # of map entries used */ /span v2106 /a>        int                     map_alloc /a>;       span class="comment">/* # of map entries allocated */ /span v2107 /a>        int                     *map /a>;            span class="comment">/* allocat 2108 /a>        void                    *data /a>;           span class="comment">/* chunk data */ /span v2109 /a>        bool /a>            2       immutable /a>;       span class="comment">/* no [de]populat 2110 /a>        unsigned long   2       populated /a>[];     span class="comment">/* populated bitmap */ /span v2111 /a>};v2112 /a>v2113 /a>static int pcpu_unit_pages /a> __read_mostly /a>;v2114 /a>static int pcpu_unit_size /a> __read_mostly /a>;v2115 /a>static int pcpu_nr_units /a> __read_mostly /a>;v2116 /a>static int pcpu_atom_size /a> __read_mostly /a>;v2117 /a>static int pcpu_nr_slots /a> __read_mostly /a>;v2118 /a>static size_t /a> pcpu_chunk_struct_size /a> __read_mostly /a>;v2119 /a>v212tioa> span class="comment">/* cpus with the lowest and highest unit addresses */ /span v2121 /a>static unsigned int pcpu_low_unit_cpu /a> __read_mostly /a>;v2122 /a>static unsigned int pcpu_high_unit_cpu /a> __read_mostly /a>;v2123 /a>v2124 /a> span class="comment">/* the address of the first chunk which starts with the kernel static area */ /span v2125 /a>void *pcpu_base_addr /a> __read_mostly /a>;v2126 /a> a href="+code=EXPORT_SYMBOL_GPL" class="sref">EXPORT_SYMBOL_GPL /a>(pcpu_base_addr /a>);v2127 /a>v2128 /a>static const int *pcpu_unit_map /a> __read_mostly /a>;           span class="comment">/* cpu -> unit */ /span v2129 /a>const unsigned long *pcpu_unit_offsets /a> __read_mostly /a>;    span class="comment">/* cpu -> unit offset */ /span v213tioa>v2131 /a> span class="comment">/* group informat 2132 /a>static int pcpu_nr_groups /a> __read_mostly /a>;v2133 /a>static const unsigned long *pcpu_group_offsets /a> __read_mostly /a>;v2134 /a>static const size_t /a> *pcpu_group_sizes /a> __read_mostly /a>;v2135 /a>v2136 /a> span class="comment">/* /span v2137 /a> span class="comment"> * The first chunk which always exists.  Note that unlike other /span v2138 /a> span class="comment"> * chunks, this one can be allocated and mapped iopseveral different /span v2139 /a> span class="comment"> * ways and thus often doesn't liv  in the vmalloc area. /span v214tioa> span class="comment"> */ /span v2141 /a>static struct pcpu_chunk /a> *pcpu_first_chunk /a>;v2142 /a>v2143 /a> span class="comment">/* /span v2144 /a> span class="comment"> * O>
 2nal reserved chunk.  This chunk reserves part of the first /span v2145 /a> span class="comment"> * chunk and serves it for reserved allocat 2146 /a> span class="comment"> * reserved offset is in pcpu_reserved_chunk_limit.  When reserved /span v2147 /a> span class="comment"> * area doesn't exist, the following variables contain NULL and 0 /span v2148 /a> span class="comment"> * respec
 vely. /span v2149 /a> span class="comment"> */ /span v2150 /a>static struct pcpu_chunk /a> *pcpu_reserved_chunk /a>;v2151 /a>static int pcpu_reserved_chunk_limit /a>;v2152 /a>v2153 /a> span class="comment">/* /span v2154 /a> span class="comment"> * Synchronizat 2155 /a> span class="comment"> * /span v2156 /a> span class="comment"> * There are two locks - pcpu_alloc_mutex and pcpu_lock.  The former /span v2157 /a> span class="comment"> * protects allocat 2158 /a> span class="comment"> * vmalloc mapping.  The latter is a spinlock and protects the index /span v2159 /a> span class="comment"> * data structures - chunk slots, chunks and area maps in chunks. /span v216tioa> span class="comment"> * /span v2161 /a> span class="comment"> * During allocat 2162 /a> span class="comment"> * pcpu_lock is grabbed and released as necessary.  All ac
ual memory /span v2163 /a> span class="comment"> * allocat 2164 /a> span class="comment"> * general, percpu memory can't be allocated with irq off but /span v2165 /a> span class="comment"> * irqsave/restore are still used iopalloc path so that it can be used /span v2166 /a> span class="comment"> * from early init path - sched_init() specifically. /span v2167 /a> span class="comment"> * /span v2168 /a> span class="comment"> * Free path accesses and alters only the index data structures, so it /span v2169 /a> span class="comment"> * can be safely called from atomic context.  When memory needs to be /span v217tioa> span class="comment"> * returned to the system, free path schedules reclaim_work which /span v2171 /a> span class="comment"> * grabs both pcpu_alloc_mutex and pcpu_lock, unlinks chunks to be /span v2172 /a> span class="comment"> * reclaimed, release both locks and frees the chunks.  Note that it's /span v2173 /a> span class="comment"> * necessary to grab both locks to remove a chunk from circulat 2174 /a> span class="comment"> * allocat 2175 /a> span class="comment"> * pcpu_alloc_mutex locked. /span v2176 /a> span class="comment"> */ /span v2177 /a>static DEFINE_MUTEX /a>(pcpu_alloc_mutex /a>);   span class="comment">/* protects whole alloc and reclaim */ /span v2178 /a>static DEFINE_SPINLOCK /a>(pcpu_lock /a>);       span class="comment">/* protects index data structures */ /span v2179 /a>v2180 /a>static struct list_head /a> *pcpu_slot /a> __read_mostly /a>;  span class="comment">/* chunk list slots */ /span v2181 /a>v2182 /a> span class="comment">/* reclaim work to release fully free chunks, scheduled from free path */ /span v2183 /a>static void pcpu_reclaim /a>(struct work_struct /a> *work /a>);v2184 /a>static DECLARE_WORK /a>(pcpu_reclaim_work /a>, pcpu_reclaim /a>);v2185 /a>v2186 /a>static bool /a> pcpu_addr_in_first_chunk /a>(void *addr /a>)v2187 /a>{v2188 /a>        void *first_start /a> = pcpu_first_chunk /a>->base_addr /a>;v2189 /a>v2190 /a>        return addr /a> >= first_start /a> && addr /a> < first_start /a> + pcpu_unit_size /a>;v2191 /a>}v2192 /a>v2193 /a>static bool /a> pcpu_addr_in_reserved_chunk /a>(void *addr /a>)v2194 /a>{v2195 /a>        void *first_start /a> = pcpu_first_chunk /a>->base_addr /a>;v2196 /a>v2197 /a>        return addr /a> >= first_start /a> &&v2198 /a>        2       addr /a> < first_start /a> + pcpu_reserved_chunk_limit /a>;v2199 /a>}v220tioa>v2201 /a>static int __pcpu_size_to_slot /a>(int size /a>)v2202 /a>{v2203 /a>        int highbit /a> = fls /a>(size /a>);         span class="comment">/* size is in bytes */ /span v2204 /a>        return max /a>(highbit /a> - PCPU_SLOT_BASE_SHIFT /a> + 2, 1);v2205 /a>}v2206 /a>v2207 /a>static int pcpu_size_to_slot /a>(int size /a>)v2208 /a>{v2209 /a>        if (size /a> == pcpu_unit_size /a>)v2210 /a>                return pcpu_nr_slots /a> - 1;v2211 /a>        return __pcpu_size_to_slot /a>(size /a>);v2212 /a>}v2213 /a>v2214 /a>static int pcpu_chunk_slot /a>(const struct pcpu_chunk /a> *chunk /a>)v2215 /a>{v2216 /a>        if (chunk /a>->free_size /a> < sizeof(int) || chunk /a>->contig_hint /a> < sizeof(int))v2217 /a>                return 0;v2218 /a>v2219 /a>        return pcpu_size_to_slot /a>(chunk /a>->free_size /a>);v222tioa>}v2221 /a>v2222 /a> span class="comment">/* set the pointer to a chunk in a page struct */ /span v2223 /a>static void pcpu_set_page_chunk /a>(struct page /a> *page /a>, struct pcpu_chunk /a> *pcpu /a>)v2224 /a>{v2225 /a>        page /a>->index /a> = (unsigned long)pcpu /a>;v2226 /a>}v2227 /a>v2228 /a> span class="comment">/* obtain pointer to a chunk from a page struct */ /span v2229 /a>static struct pcpu_chunk /a> *pcpu_get_page_chunk /a>(struct page /a> *page /a>)v223tioa>{v2231 /a>        return (struct pcpu_chunk /a> *)page /a>->index /a>;v2232 /a>}v2233 /a>v2234 /a>static int __maybe_unused /a> pcpu_page_idx /a>(unsigned int cpu /a>, int page_idx /a>)v2235 /a>{v2236 /a>        return pcpu_unit_map /a>[cpu /a>] * pcpu_unit_pages /a> + page_idx /a>;v2237 /a>}v2238 /a>v2239 /a>static unsigned long pcpu_chunk_addr /a>(struct pcpu_chunk /a> *chunk /a>,v2240 /a>                                     unsigned int cpu /a>, int page_idx /a>)v2241 /a>{v2242 /a>        return (unsigned long)chunk /a>->base_addr /a> + pcpu_unit_offsets /a>[cpu /a>] +v2243 /a>                (page_idx /a> << PAGE_SHIFT /a>);v2244 /a>}v2245 /a>v2246 /a>static void __maybe_unused /a> pcpu_next_unpop /a>(struct pcpu_chunk /a> *chunk /a>,v2247 /a>                                           int *rs /a>, int *re /a>, int end /a>)v2248 /a>{v2249 /a>        *rs /a> = find_next_zero_bit /a>(chunk /a>->populated /a>, end /a>, *rs /a>);v2250 /a>        *re /a> = find_next_bit /a>(chunk /a>->populated /a>, end /a>, *rs /a> + 1);v2251 /a>}v2252 /a>v2253 /a>static void __maybe_unused /a> pcpu_next_pop /a>(struct pcpu_chunk /a> *chunk /a>,v2254 /a>                                         int *rs /a>, int *re /a>, int end /a>)v2255 /a>{v2256 /a>        *rs /a> = find_next_bit /a>(chunk /a>->populated /a>, end /a>, *rs /a>);v2257 /a>        *re /a> = find_next_zero_bit /a>(chunk /a>->populated /a>, end /a>, *rs /a> + 1);v2258 /a>}v2259 /a>v226tioa> span class="comment">/* /span v2261 /a> span class="comment"> * (Un)populated page reg 2262 /a> span class="comment"> * page reg 2263 /a> span class="comment"> * be integer variables and will be set to start and end page index of /span v2264 /a> span class="comment"> * the current reg 2265 /a> span class="comment"> */ /span v2266 /a>#define pcpu_for_each_unpop_reg (chunk /a>, rs /a>, re /a>, start /a>, end /a>)               \v2267 /a>        for ((rs /a>) = (start /a>), pcpu_next_unpop /a>((chunk /a>), &(rs /a>), &(re /a>), (end /a>)); \v2268 /a>        2    (rs /a>) < (re /a>);                                                   \v2269 /a>        2    (rs /a>) = (re /a>) + 1, pcpu_next_unpop /a>((chunk /a>), &(rs /a>), &(re /a>), (end /a>)))v227tioa>v2271 /a>#define pcpu_for_each_pop_reg (chunk /a>, rs /a>, re /a>, start /a>, end /a>)                 \v2272 /a>        for ((rs /a>) = (start /a>), pcpu_next_pop /a>((chunk /a>), &(rs /a>), &(re /a>), (end /a>));   \v2273 /a>             (rs /a>) < (re /a>);                                                   \v2274 /a>             (rs /a>) = (re /a>) + 1, pcpu_next_pop /a>((chunk /a>), &(rs /a>), &(re /a>), (end /a>)))v2275 /a>v2276 /a> span class="comment">/** /span v2277 /a> span class="comment"> * pcpu_mem_zalloc - allocate memory /span v2278 /a> span class="comment"> * @size: bytes to allocate /span v2279 /a> span class="comment"> * /span v228tioa> span class="comment"> * Allocate @size bytes.  If @size is smaller than PAGE_SIZE, /span v2281 /a> span class="comment"> * kzalloc() is used; otherwise, vzalloc() is used.  The returned /span v2282 /a> span class="comment"> * memory is always zeroed. /span v2283 /a> span class="comment"> * /span v2284 /a> span class="comment"> * CONTEXT: /span v2285 /a> span class="comment"> * Does GFP_KERNEL allocat 2286 /a> span class="comment"> * /span v2287 /a> span class="comment"> * RETURNS: /span v2288 /a> span class="comment"> * Pointer to the allocated area on success, NULL on failure. /span v2289 /a> span class="comment"> */ /span v2290 /a>static void *pcpu_mem_zalloc /a>(size_t /a> size /a>)v2291 /a>{v2292 /a>        if (WARN_ON_ONCE /a>(!slab_is_available /a>()))v2293 /a>                return NULL /a>;v2294 /a>v2295 /a>        if (size /a> <= PAGE_SIZE /a>)v2296 /a>                return kzalloc /a>(size /a>, GFP_KERNEL /a>);v2297 /a>        elsev2298 /a>        2       return vzalloc /a>(size /a>);v2299 /a>}v230tioa>v2301 /a> span class="comment">/** /span v2302 /a> span class="comment"> * pcpu_mem_free - free memory /span v2303 /a> span class="comment"> * @ptr: memory to free /span v2304 /a> span class="comment"> * @size: size of the area /span v2305 /a> span class="comment"> * /span v2306 /a> span class="comment"> * Free @ptr.  @ptr should have been allocated using pcpu_mem_zalloc(). /span v2307 /a> span class="comment"> */ /span v2308 /a>static void pcpu_mem_free /a>(void *ptr /a>, size_t /a> size /a>)v2309 /a>{v2310 /a>        if (size /a> <= PAGE_SIZE /a>)v2311 /a>                kfree /a>(ptr /a>);v2312 /a>        elsev2313 /a>                vfree /a>(ptr /a>);v2314 /a>}v2315 /a>v2316 /a> span class="comment">/** /span v2317 /a> span class="comment"> * pcpu_chunk_relocate - put chunk in the appropriate chunk slot /span v2318 /a> span class="comment"> * @chunk: chunk of interest /span v2319 /a> span class="comment"> * @oslot: the previous slot it was on /span v232tioa> span class="comment"> * /span v2321 /a> span class="comment"> * This funct 2322 /a> span class="comment"> * New slot according to the changed state is determined and @chunk is /span v2323 /a> span class="comment"> * moved to the slot.  Note that the reserved chunk is never put on /span v2324 /a> span class="comment"> * chunk slots. /span v2325 /a> span class="comment"> * /span v2326 /a> span class="comment"> * CONTEXT: /span v2327 /a> span class="comment"> * pcpu_lock. /span v2328 /a> span class="comment"> */ /span v2329 /a>static void pcpu_chunk_relocate /a>(struct pcpu_chunk /a> *chunk /a>, int oslot /a>)v233tioa>{v2331 /a>        int nslot /a> = pcpu_chunk_slot /a>(chunk /a>);v2332 /a>v2333 /a>        if (chunk /a> != pcpu_reserved_chunk /a> && oslot /a> != nslot /a>) {v2334 /a>                if (oslot /a> < nslot /a>)v2335 /a>                        list_move /a>(&chunk /a>->list /a>, &pcpu_slot /a>[nslot /a>]);v2336 /a>                elsev2337 /a>                        list_move_tail /a>(&chunk /a>->list /a>, &pcpu_slot /a>[nslot /a>]);v2338 /a>        }v2339 /a>}v234tioa>v2341 /a> span class="comment">/** /span v2342 /a> span class="comment"> * pcpu_need_to_extend - determine whether chunk area map needs to be extended /span v2343 /a> span class="comment"> * @chunk: chunk of interest /span v2344 /a> span class="comment"> * /span v2345 /a> span class="comment"> * Determine whether area map of @chunk needs to be extended to /span v2346 /a> span class="comment"> * accommodate a new allocat 2347 /a> span class="comment"> * /span v2348 /a> span class="comment"> * CONTEXT: /span v2349 /a> span class="comment"> * pcpu_lock. /span v235tioa> span class="comment"> * /span v2351 /a> span class="comment"> * RETURNS: /span v2352 /a> span class="comment"> * New target map allocat 2353 /a> span class="comment"> * otherwise. /span v2354 /a> span class="comment"> */ /span v2355 /a>static int pcpu_need_to_extend /a>(struct pcpu_chunk /a> *chunk /a>)v2356 /a>{v2357 /a>        int new_alloc /a>;v2358 /a>v2359 /a>        if (chunk /a>->map_alloc /a> >= chunk /a>->map_used /a> + 2)v2360 /a>                return 0;v2361 /a>v2362 /a>        new_alloc /a> = PCPU_DFL_MAP_ALLOC /a>;v2363 /a>        while (new_alloc /a> < chunk /a>->map_used /a> + 2)v2364 /a>                new_alloc /a> *= 2;v2365 /a>v2366 /a>        return new_alloc /a>;v2367 /a>}v2368 /a>v2369 /a> span class="comment">/** /span v237tioa> span class="comment"> * pcpu_extend_area_map - extend area map of a chunk /span v2371 /a> span class="comment"> * @chunk: chunk of interest /span v2372 /a> span class="comment"> * @new_alloc: new target allocat 2373 /a> span class="comment"> * /span v2374 /a> span class="comment"> * Extend area map of @chunk to have @new_alloc entries. /span v2375 /a> span class="comment"> * /span v2376 /a> span class="comment"> * CONTEXT: /span v2377 /a> span class="comment"> * Does GFP_KERNEL allocat 2378 /a> span class="comment"> * /span v2379 /a> span class="comment"> * RETURNS: /span v238tioa> span class="comment"> * 0 on success, -errno on failure. /span v2381 /a> span class="comment"> */ /span v2382 /a>static int pcpu_extend_area_map /a>(struct pcpu_chunk /a> *chunk /a>, int new_alloc /a>)v2383 /a>{v2384 /a>        int *old /a> = NULL /a>, *new /a> = NULL /a>;v2385 /a>        size_t /a> old_size /a> = 0, new_size /a> = new_alloc /a> * sizeof(new /a>[0]);v2386 /a>        unsigned long flags /a>;v2387 /a>v2388 /a>        new /a> = pcpu_mem_zalloc /a>(new_size /a>);v2389 /a>        if (!new /a>)v2390 /a>                return -ENOMEM /a>;v2391 /a>v2392 /a>         span class="comment">/* acquire pcpu_lock and switch to new area map */ /span v2393 /a>        spin_lock_irqsave /a>(&pcpu_lock /a>, flags /a>);v2394 /a>v2395 /a>        if (new_alloc /a> <= chunk /a>->map_alloc /a>)v2396 /a>                goto out_unlock /a>;v2397 /a>v2398 /a>        old_size /a> = chunk /a>->map_alloc /a> * sizeof(chunk /a>->map /a>[0]);v2399 /a>        old /a> = chunk /a>->map /a>2e=new_alloass="sref4idvaL300" class="line" n4line"4nam vaL300">230tioa>v2399 /a>        (pcpu_lock /a>, pcpu_lock /a>, map /a>[0]);v2332 /a>v2393 /a>        chunk /a>->>new_size /a> = map /a>[0]);v22ef">old /a> = chunk /a>->>new_size /a> = map /a>[0]);v2385 /a>        new /a> = NULL /a>;v2206 /a>v:L206">2206 /a>v2398 /a>        < classs="srref" chuoa href="+code=re" classs="srref" chuoa n_lock_irqsave /a>(&pcpu_lock /a>, flags /a>);v2259 /a>v23L260">226tioa> span class="comment">/* /span v2381 /a> span claaaaaaaaass="comment"> *() mightt to upis fuew sv"> *() whi_loused and @chunk is /span v2372 /a> span claaaaaaaaassIRQ-unsafe  acquire thuhis n'tchuns functundd chand releases pcpu_lock. /span v2373 /a> span claaaaaaaaasnew area map */ /span v22ef">old /a> = pcpucpu_lock /a>, pcpu_lock /a>, map /a>[0]);v2225 /a>        pcpucpu_lock /a>, pcpu_lock /a>, new_size /a>);v2206 /a>v22              return 0;v2258 /a>}v2259 /a>v232tioa> span class="comment">/** /span v2321 /a> span class classplit_b acqu- split tch tobs="srecomment">/** /span v2322 /a> span class="comment"> * @chunk: chunk of interest /span v2323 /a> span class@i:t and endch tobs="snd wiplitnk of interest /span v2324 /a> span class@head: headent"> inent"> *(s nchun0)nk of interest /span v2325 /a> span clas @ef">: ef">ent"> inent"> *(s nchun0)nk of interest /span v2326 /a> span clasnk of interest /span v2327 /a> span classSplit  2328 /a> span clas non-ory ,izheadent"> *bs="snusnunserve bbefoa *bs="sn@is="cew sitnk of interest /span v2379 /a> span classko @i+1cat  * Allizheadent"> ases pcpu_lock. /span v235tioa> span class="comment"> * /span v2321 /a> span class@sizef">e if on-ory ,i  * /span v2322 /a> span classdep toew sonizhead,e ifo.duce bbyizef">ent"> *is deef">ent">obs="srecomment">/** /span v2323 /a> span classusnunserve b 2344 /a> span class="comment"> * /span v2325 /a> span clas @t"> *ref">h tomustp of @enough allocent">* @si"comment"> "> * plitases pcpu_lock. /span v2326 /a> span clasnk of interest /span v2327 /a> span class="comment"> * CONTEXT: /span v2328 /a> span clas hand releases pcpu_lock. /span v2289 /a> span class="comment"> */ /span v2290 /25 /a>        (struct pcpu_chunk /a> *chunk /a>, int  */ /span v2311 /a>               f">chunk /a>, int chunk /a>, int list>map_alloc /a>)v2383 /a>{v22f">chunk /a>, int         if (!        if (!list      return 0;v2394 /a>v2225 /a>        pcpucpu_lock /a>, chunk /a>->mew_alloc /a> < chunk /a>->mhunk /a>, int new_size /a>);v2206 /a>v2292 /a>         span classunserv and subbs="saass="comment"> */ /span v2398 /a>        (&chunk /a>->mhunk /a>, int list /a>, &chunk /a>-> */ /span v2269 /aaaap_alloc /a> * sizeof(chunk /a>->chunk /a>->, int new_size /a>);v22lloc /a> < chunk /a>->>new_size /a> = 2391 /a>v2292 /a>        if (nslot /a>) {v2313 /a>                chunk /a>->m1]"sref">old /a> = chunk /a>->, int new_size /a>);v2254 /a>  ef">old /a> = chunk /a>->old /a> = new_size /a>);v22L258">2258 /a>}v2292 /a>        if (list>ef">nslot /a>) {v2337 /a>  ef">old /a> = chunk /a>->old /a> = list      return 0;v2298 /a>  ef">old /a> = chunk /a>->old /a> = list      return 0;v23L258">2258 /a>}v2258 /a>}v2361 /a>v2262 /a> span class="comment">/** /span v2263 /a> span class classs="sf">pccpu_mem_zall">pccfrom a  class="srefcomment">/** /span v2264 /a> span class="comment"> * @chunk: chunk of interest /span v2265 /a> span class="commewanve bnt"> inent"> nk of interest /span v2376 /a> span class@alignmewanve balignnk of interest /span v2347 /a> span class="comment"> * /span v2328 /a> span clas T> * @p_mem_zall"> * Allocal">pccaligne bats@aligncfrom  free changed @chunk. /span v2369 /a> span class=o the slot.comment"> * onlyp_mem_zals "> *offsetg 237tioa> span class=ate ovesan h to 2371 /a> span clashanged @chunk. /span v2372 /a> span class=t"> *ref">h tomustp of @slo  Grt two allocent">changed @chunk. /span v2373 /a> span class="comment"> * /span v2374 /a> span class="comment"> * CONTEXT: /span v2375 /a> span clas hand releases pcpu_lock. /span v2376 /a> span classes pcpu_lock. /span v2377 /a> span class="comment"> * RETURNS: /span v2278 /a> span class="commend*offset ined area comment"> * 01292 no h tchew s">pcced and @chunk is /span v2379 /a> span classfouns always zeroed. /span v238tioa> span class="comment"> */ /span v2382 /a>static int pcode=pcpu_chunk" classs="sf">pcxtend_area_map /a>(struct pcpu_chunk /a> *chunk /a>, int chunk /a>, int map_alloc /a>)v2383 /a>{v22f">chunk /a>, int nslot /a> = pcpu_chunk_slot /a>(chunk /a>);v2384 /chunk /a>->23f">chunk /a>, int , int 2206 /a>v2372 /ahunk /a>, int old_size /a> = 0, , int mew_alloc /a> < chunk /a>->>new_size /a> = pcpucpu_lock /a>, chunk /a>->ef">nslot /a>) {v2298 /a>  ef">old /a> = , int nslot /a> = m1 =alloc /a> >= chunk /a>->2269 /aaaaf">chunk /a>, int old /a> = list      return 0;v230tioa>v2311 /a>   2 /a>         span classs="ra372 /alignpan  recommepan  ss="comment"> */ /span v2398 /a>  ef">old /a> =  >= pcpucpu_lock /a>, old /a> = "-chunk /a>, int 2293 /a>  25 /a>        pcpucpu_lock /a>, ef rved_chunk /a> && chunk /a>);v2394 /a>v2369 /aaaaf9 /a>        if (chunk /a>->map_alloc /a>)v2396 /a>          continueef">chunk /a>);v2337 /a>  f9 /a>        if (chunk /a>-> && mhunk /a>, int nslot /a>) {v2298 /a>  93 /a>  25 /a>        pcpucpu_lock /a>, chunk /a>->old /a> = chunk /a>);v2269 /aaaa        continueef">chunk /a>);v2390 /a>  L258">2258 /a>}v2361 /a>v2398 /a>  e260">226tioa> span class="comment">/* /span v2303 /a> span claaaaaaaaaaaaaaaaass@siheadeed small an th> * @oslot:bs="snusnallo,s="comment">/* /span v2304 /a> span claaaaaaaaaaaaaaaaassmerge'emed to the slo'small' changfine bad smallers="comment">/* /span v2305 /a> span claaaaaaaaaaaaaaaaasse snap_allocf">), whi_lochavery small butochn'tcto be extended to /span v2306 /a> span claaaaaaaaaaaaaaaaassuncommen372 / vchanged @chunk. /span v2307 /a> span claaaaaaaaaaaaaaaaass="comment"> */ /span v2298 /a>  92 /a>        if (        if () ||               chunk /a>->a0>sef">nslot /a>) {v2269 /aaaa        f9 /a>        if (chunk /a>->a0>">nslot /a>) {v2390 /a>                  a>        if (chunk /a>->>new_size /a> = new_size /a>);v2311 /a>              ef">nslot /a>) {v2398 /a>                  a>        if (chunk /a>->old /a> = new_size /a>);v2313 /a>                  a>        if (chunk /a>->old /a> = new_size /a>);v2254 /a>          L258">2258 /a>}v2369 /aaaa        a>        if (chunk /a>->old /a> = new_size /a>);v2396 /a>          a> && >new_size /a> = new_size /a>);v2337 /a>                        2298 /a>  L258">2258 /a>}v2259 /a>v2390 /a>  92 /a>         span classuf ef">e ifsmall, justpkeep prearounsass="comment"> */ /span v2311 /a>   f">old /a> = list"sref">old /a> = chunk /a>->, int , int 2398 /a>  92 /a>        if (listrvew_ap_allocf">)>">nslot /a>) {v2313 /a>           f">old /a> = list"sr       return 0;v2394 /a>v2369 /aaaa92 /a>         span classsplit 92 warranve bss="comment"> */ /span v2396 /a>  92 /a>        if (list>ef">nslot /a>) {v2337 /a>                        old /a> = old /a> = , int old /a> = listref">chunk /a>);v2298 /a>  93 /a>  92 /a>        if (nslot /a>) {v2269 /aaaa                              chunk /a>);v2390 /a>                  a>        if (>new_size /a> = new_size /a>);v2311 /a>                  a>        if (pcpucpu_lock /a>, chunk /a>->old /a> = chunk /a>);v2398 /a>          L258">2258 /a>}v2313 /a>          92 /a>        if (list>258">2258 /a>}v2334 /a>                  a>        if (pcpucpu_lock /a>, chunk /a>->old /a> = chunk /a>);v2335 /a>  L258">2258 /a>}v2206 /a>v2337 /a>  92 /a>         span classupnt"> hf">cis dmarkp_mem_zal bss="comment"> */ /span v2298 /a>  92 /a>        if (258">2258 /a>}v2269 /aaaa        cpu_lock /a>, chunk /a>->f="+code=chunk" ontig_hf">s="sref25 /a>         */ /span v2390 /a>      nt"> */ /span v2311 /a>          cpu_lock /a>, chunk /a>->f="+code=chunk" ontig_hf">s="sref25 /a>        pcpucpu_lock /a>, chunk /a>->f="+code=chunk" ontig_hf">s="srnt"> */ /span v2398 /a>                  311 /a>          cpu_lock /a>, chunk /a>);vchunk /a>);v2254 /a>  ef">old /a> = chunk /a>->old /a> = chunk /a>->chunk /a>);v2369 /aaaa9f">old /a> = chunk /a>->chunk /a>->chunk /a>);v2206 /a>v2337 /a>  ef">old /a> = < class="srereem_zal=pcpu_mem_free" class="srereem_zalxtendef">old /a> = old /a> = chunk /a>);v2298 /a>  66 /a>        return 23L258">2258 /a>}v230tioa>v2399 /a>        chunk /a>->f="+code=chunk" ontig_hf">s="sref25 /a>        2392 /a>         span classfully scannl bss="comment"> */ /span v2362 /a>        < class="srereem_zal=pcpu_mem_free" class="srereem_zalxtendef">old /a> = old /a> = chunk /a>);vchunk /a>);v2292 /a>         span classtell th> up;v< laypis pccss="comment"> */ /span v22        1ef">chunk /a>);v2258 /a>}v2397 /a>v2278 /a> span class="comment">/** /span v2379 /a> span class clasallor">pccpualloc">pcc @p_  class="srefcomment">/** /span v237tioa> span class="comment"> * @chunk: chunk of interest /span v2371 /a> span class=allome:*offset tend>pcc @pref">p of interest /span v2262 /a> span classes pcpu_lock. /span v2263 /a> span classFlloc">pccstartew sfrom  allomesko @free c s=o the slot.comment"> *ses pcpu_lock. /span v2264 /a> span classonlypmodifils "> *c: new targ clg 2265 /a> span class 2376 /a> span clashanged @chunk. /span v2347 /a> span class="comment"> * CONTEXT: /span v2328 /a> span clas hand releases pcpu_lock. /span v2369 /a> span class="comment"> */ /span v2290 /25 /a>        pc=pcpu_mem_free" clasallor">pcxtend_area_map /a>(struct pcpu_chunk /a> *chunk /a>, int 258">2258 /a>}vnslot /a>) {v229">chunk /a>, int nslot /a> = pcpu_chunk_slot /a>(chunk /a>);v22f">chunk /a>, int , int 2394 /a>v2272 /ahunk /a>, int old_size /a> = 0, , int mew_alloc /a> < chunk /a>->>new_size /a> = pcpucpu_lock /a>, chunk /a>->L394">2394 /a>v2396 /a>  92 /a>        if (new_size /a> = 258">2258 /a>}v2337 /a>          b>pck      return 0;v2398 /a>        pcpucpu_lock /a>, new_size /a> =       return 0;v2399 /a>        pcpucpu_lock /a>, chunk /a>->a0>      return 0;v230tioa>v2399 /a>        chunk /a>->chunk /a>->chunk /a>);v2362 /a>        chunk /a>->>new_size /a> = chunk /a>->chunk /a>);vchunk /a>);v2292 /a>         span classmerge with * @oslot?ass="comment"> */ /span v23f2 /a>        if (mf">a0rved_chunk /a> && chunk /a>->ef ref">nslot /a>) {v2396 /a>  a> && chunk /a>->>new_size /a> = chunk /a>->chunk /a>);v2337 /a>  ef">old /a> = chunk /a>->chunk /a>);v2298 /a>  ef">old /a> = (&chunk /a>->list /a>, &chunk /a>->chunk /a>);v2269 /aaaaaaaaaaaa=lloc /a> < chunk /a>->, int  * sizeof(chunk /a>->2390 /a>  9unk /a>, int chunk /a>);v23L258">2258 /a>}v2392 /a>         span classmerge with next?ass="comment"> */ /span v22f2 /a>        if (>m1 mew_alloc /a> < chunk /a>-> && chunk /a>->ef ref">nslot /a>) {v2254 /a>  ef">old /a> = chunk /a>->>new_size /a> = chunk /a>->chunk /a>);v2369 /aaaaef">old /a> = chunk /a>->chunk /a>);v2396 /a>  ef">old /a> = (&chunk /a>->(&chunk /a>->chunk /a>);v2337 /a>  aaaaaaaa=lloc /a> < chunk /a>->        if (>m1)) *ap_alloc /a> * sizeof(chunk /a>->22L258">2258 /a>}v2259 /a>v23 /a> * sizeof(chunk /a>->f="+code=chunk" ontig_hf">s="sref25 /a>        pcpucpu_lock /a>, chunk /a>->old /a> = chunk /a>->f="+code=chunk" ontig_hf">s="s>      return 0;v2399 /a>        < class="srereem_zal=pcpu_mem_free" class="srereem_zalxtendef">old /a> = old /a> = chunk /a>);v2258 /a>}vchunk /a>);v2_area_map /a>(struct pcpu_chunk /a> *< classs="sff="+code=pcpu_chunk" classs="sff="+cxtend290 >258">2258 /a>}vnslot /a>) {v23_area_map /a>(struct pcpu_chunk /a> *chunk /a>);v2397 /a>v2398 /a>        nslot /a> = old /a> = < class="srefarea_ref="+code=new_size" class="srefarea_ref="s="sref">chunk /a>);v22f2 /a>        if (!chunk /a>);v2390 /a>  66 /a>        return chunk /a>);v2361 /a>v2362 /a>        chunk /a>->nslot /a> = old /a> = pcL361">2361 /a>v2313 /a>                                  p_alloc /a> * sizeof(chunk /a>->22f2 /a>        if (!chunk /a>->nslot /a>) {v2369 /aaaachunk /a>->pu_chunk_slot /a>(chunk /a>);v2396 /a>  66 /a>        return chunk /a>);v23L258">2258 /a>}v2258 /a>}v2399 /a>        chunk /a>->ef">nslot /a> = ef">chunk /a>);v23 /a> * sizeof(chunk /a>->chunk /a>->old /a> = ef">chunk /a>);v2361 /a>v2362 /a>        (&chunk /a>->chunk /a>);v23save /a>(&chunk /a>->old /a> = ef">chunk /a>);v23save /a>(&chunk /a>->f="+code=chunk" ontig_hf">s="sref25 /a>        ef">chunk /a>);vchunk /a>);v2366 /a>        return chunk /a>);v2258 /a>}v2258 /a>}v2290 /25 /a>        pcpu_chunk /a> *chunk /a>);vnslot /a>) {v23f2 /a>        if (!chunk /a>);v2398 /a>  66 /a>ef">chunk /a>);v23save /a>(&pcpucpu_lock /a>, chunk /a>->old /a> = chunk /a>->*ap_alloc /a> * sizeof(chunk /a>->23save /a>(&pu_chunk_slot /a>(chunk /a>);v2258 /a>}v2206 /a>v2347 /a> span class="comment">/* /span v2328 /a> span clas C"> * managepan  implepan w tarases pcpu_lock. /span v2369 /a> span classes pcpu_lock. /span v237tioa> span classT@p_memw differan  implepan w tars,nt"> * ss="s/alloc"ndses pcpu_lock. /span v2371 /a> span class[de]pate ovtargare implepan ed inea separovesfile whi_lochate ledses pcpu_lock. /span v2372 /a> span classf">oot.commile is d> spiled together.  Thesfomemwew sfent"> *d and @chunk is /span v2263 /a> span classshould be implepan edases pcpu_lock. /span v2264 /a> span classes pcpu_lock. /span v2375 /a> span clas hand pate ovess="sr2398 /a>  -s=ate oves /** /span v2376 /a> span classhand depate ovess="sr2398 /a>-sdepate oves /** /span v2347 /a> span class classreovess="sr2398 /a>  a>-ssreovend new s="srefcomment">/** /span v2328 /a> span clas hand de_aroyss="sr2398 /a>  a-sde_aroynd s="sr, ssways * @cedld bysfullsdepatefcomment">/** /span v2379 /a> span class clasaddr_to_page2398 /a>  a>-strans ovesaddresssko physicalsaddressefcomment">/** /span v237tioa> span class=clasverifysss="sfinfo/a>  a>-sshec* ss="sfinfo/comacceptable durew sini_efcomment">/** /span v2371 /a> span class="comment"> */ /span v2382 /a>static int pcpu_chunk /a> *chunk /a>, int chunk /a>, int chunk /a>);v2290 /25 /a>        pcpu_chunk /a> *chunk /a>, int chunk /a>, int chunk /a>);v2_area_map /a>(struct pcpu_chunk /a> *< classreovess="srode=pcpu_chunk" classreovess="srxtend290 >ef">chunk /a>);v2290 /25 /a>        pcpu_chunk /a> *chunk /a>);v2_area_map /a>(struct pcpu_chunk /a> *< classddr_to_pageode=pcpu_chunk" classddr_to_pagextend290 pcpu_chunk /a> *chunk /a>);v2382 /a>static int <__ini_ode=pcpu_chunk"__ini_ef">ppu_chunk /a> *< clasverifysss="sfinfoode=pcpu_chunk" clasverifysss="sfinfoxtendc *dt2_area_map /a>(struct chunk /a>);v2258 /a>}v(struct 2258 /a>}vchunk /a>/a>}v258">2258 /a>}v */ /span vchunk /a>/a>}v258">2258 /a>}v2258 /a>}v2394 /a>v2265 /a> span class="comment">/** /span v2376 /a> span clas  class="srssddr_searcha-sdetermL36nt"> *  ontainiw sspecifild addressefcomment">/** /span v2347 /a> span class@addr:saddresss72 /whi_lo  * needssko besdetermL36dases pcpu_lock. /span v2328 /a> span classes pcpu_lock. /span v2369 /a> span clas RETURNSnt"> * CONTEXT: /span v237tioa> span classThesaddressstenthesfounsat"> *ases pcpu_lock. /span v2371 /a> span class="comment"> */ /span v2_area_map /a>(struct pcpu_chunk /a> *< class="srssddr_searchode=pcpu_chunk" class="srssddr_searchxtend290 pcpu_chunk /a> * */ /span vnslot /a>) {v2292 /a>         span classcomit 9nnthesfirdt2s="sr?ass="comment"> */ /span v23f2 /a>        if (< classddr_in_firdtff="+code=pcpu_chunk" classddr_in_firdtff="+c>pu_chunk_slot /a>(nslot /a>) {v2396 /a>  92 /a>         span classcomit 9nnthesreservld areo?ass="comment"> */ /span v2337 /a>  f2 /a>        if (< classddr_in_reservldff="+code=pcpu_chunk" classddr_in_reservldff="+c>pu_chunk_slot /a>( */ /span v2298 /a>  93 /a>  66 /a>        return < clasreservldff="+code=pcpu_chunk" clasreservldff="+c>pu_>258">2258 /a>}v2269 /aaaa66 /a>        return < clasfirdtff="+code=pcpu_chunk" clasfirdtff="+c>pu_>258">2258 /a>}v23L258">2258 /a>}v2361 /a>v2392 /a>         span clas="comment"> */ /span v2303 /a> span claaaaaaaaassThesaddressscomre ovtvesko uni_0/whi_lomight besunss="c"ndses pcpu_lock. /span v2304 /a> span claaaaaaaaass  uni_sspacestentheses pcpu_lock. /span v2305 /a> span claaaaaaaaa* curran  process2 /be72 e lookew sit up 9nnthesvmss="sres pcpu_lock. /span v2306 /a> span claaaaaaaaa*sspacec s=o the sloany possible a hper c6">besus="chere, s be extended to /span v2307 /a> span claaaaaaaaass 2328 /a> span claaaaaaaaass="comment"> */ /span v2399 /a>        >new_size /a> = < clasuni_roffsetef="+code=flags" clasuni_roffseteass="ew_size /a> = pu_c)]ef">chunk /a>);v2366 /a>        return < clasget_pageff="+code=pcpu_chunk" clasget_pageff="+c>pu_chunk_slot /a>(< classddr_to_pageode=pcpu_chunk" classddr_to_pagextendhunk_slot /a>(chunk /a>);v2258 /a>}v2258 /a>}v2303 /a> span class="comment">/** /span v2264 /a> span class classs="s>-sthes v/** /span v2375 /a> span clas @ cla:ap_al tend>pcc @p_mem_zal 9nnbytesefcomment">/** /span v2376 /a> span clas @align: alignpan  tend>pcc(max PAGE_SIZE)efcomment">/** /span v2347 /a> span class@reservld:p_mem_zal from thesreservld t"> * f2 availableefcomment">/** /span v2328 /a> span classes pcpu_lock. /span v2369 /a> span clas Amem_zal  vpccten@ clanbytes align="c"t @alignases pcpu_lock. /span v237tioa> span classes pcpu_lock. /span v2371 /a> span class="comment"> * CONTEXT: /span v2372 /a> span classDoes GFP_KERNEL*c: new tarases pcpu_lock. /span v2263 /a> span classes pcpu_lock. /span v2264 /a> span classRETURNSnt"> * CONTEXT: /span v2375 /a> span clas Pv _mem_zal bc>pcctn success, NULLctn failureases pcpu_lock. /span v2376 /a> span class="comment"> */ /span v2290 /25 /a>        <__ vpcpu_chunk /a> *< classf="+code=map_alloc"a hreef="+xtendef">old /a> = < cla__ode=pcpu_chunk" cla__ef">ppu_chunk /a> *old /a> = < cla__ode=pcpu_chunk" cla__ef">ppu_chunk /a> *old /a> = ppu_chunk /a> * */ /span vnslot /a>) {v22L382">2382 /a>static int 23_area_map /a>(struct pcpu_chunk /a> *chunk /a>);v23c *dt2charpcpu_chunk /a> *chunk /a>);v229">chunk /a>, int < href="+code=oslot"class="sd_size /a> = 0,  = 0, chunk /a>);v23unsign="clongnew_size /a> = chunk /a>);v22290 /25 /a>        <__ vpcpu_chunk /a> *< trode=pcpu_chunk" trs="sef">chunk /a>);vchunk /a>);v23f2 /a>        if (        if (!apu_chunk /a> * *mf">apu_chunk /a> *nslot /a>) {v2337 /a>  ef">old /a> = old /a> = 2376 /a_aring"a&quo">illegalap_al (%zu)g2 /slign (%zu)g72 /&quo">c"comment"> */ /span v2298 /a>  93 /as376">2376 /a_aring"a&quo"> vc"commereef">old /a> = < claef="+code=size" class="reef">old /a> = chunk /a>);v2269 /aaaa66 /a>        return chunk /a>);v23L258">2258 /a>}v2361 /a>v2362 /a>        (&< classs="sfmutexode=pcpu_chunk" classs="sfmutexss="ref">chunk /a>);v23save /a>(&(&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2394 /a>v2392 /a>         span classservlsreservld a: new tars from thesreservld t"> * f2 availableass="comment"> */ /span v23f2 /a>        if ( && < clasreservldff="+code=pcpu_chunk" clasreservldff="+c>pu_ref">nslot /a>) {v2337 /a>  ef">old /a> = 2258 /a>}v2258 /a>}v2269 /aaaaf2 /a>        if (apu_chunk /a> *chunk /a>->f="+code=chunk" ontig_hf">s="s>ef">nslot /a>) {v2390 /a>  37 /a>  ef">old /a> = 2376 /a_aring"a&quo">ss="s>from reservld t"> * failed&quo">c"comme>258">2258 /a>}v233333333333333333gotoeef">old /a> = pu_>258">2258 /a>}v2398 /a>  L258">2258 /a>}vchunk /a>);v2333333333while (/a>        if (        old /a> = nslot /a>) {v2369 /aaaa37 /a>  ef">old /a> = (&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2396 /a>  69 /aaaaf2 /a>        if (< clasextendr">pc_a href="+code=map" clasextendr">pc_a hxtendef">old /a> = nslot /a>) {v2337 /a>  aaaaaaaa37 /a>  ef">old /a> = 2376 /a_aring"a&quo">failedsko extendbc>pcca hctenreservld t"> *&quo">c"comme>258">2258 /a>}v2298 /a>  93 /a>          gotoeef">old /a> = pu_>258">2258 /a>}v2269 /aaaaaaaaaaaaL258">2258 /a>}v2390 /a>  37 /a>  ef">old /a> = (&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2333333333L258">2258 /a>}v2258 /a>}v2313 /a>  size /a> = 0,         pc=pcpu_mem_free" classs="sf">pcxtendef">old /a> = old /a> = chunk /a>);v233333333392 /a>        if (ef rf">chunk /a>);v2369 /aaaa37 /a>  gotoeef">old /a> = <">pc_founsode=pcpu_chunk"s>pc_founs>pu_>258">2258 /a>}v2206 /a>v2337 /a>  ef">old /a> = 2376 /a_aring"a&quo">ss="s>from reservld t"> * failed&quo">c"comme>258">2258 /a>}v2298 /a>  gotoeef">old /a> = pu_>258">2258 /a>}v22L258">2258 /a>}v230tioa>v        if (230tioa>v2392 /a>         span classsearchathrough normal t"> *sass="comment"> */ /span v2372 /ahunk /a>, int < href="+code=oslot"class="sref25 /a>        old /a> = < claef="+code=size" class=")>apu_chunk /a> *< href="+code=oslot"class="srmew_alloc /a> < pu_>apu_chunk /a> *< href="+code=oslot"class="s++ref">nslot /a>) {v2254 /a>  ef">old /a> = old /a> =  = < href="+code=oslot"class="s]reef">old /a> = nslot /a>) {v2369 /aaaa37 /a>  f2 /a>        if (apu_chunk /a> *chunk /a>->f="+code=chunk" ontig_hf">s="s>">nslot /a>) {v2396 /a>  69 /aaaaaaaaaaaa ontinue>258">2258 /a>}v2397 /a>v2298 /a>  93 /a>  a>        if (        old /a> = 2258 /a>}v2269 /aaaaaaaaaaaaf2 /a>        if (nslot /a>) {v2390 /a>  37 /a>  93 /a>  a>        if ((&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v233333333333333333aaaaaaaaf2 /a>        if (< clasextendr">pc_a href="+code=map" clasextendr">pc_a hxtendef">old /a> = chunk /a>);v2398 /a>                                           size /a> = 0, nslot /a>) {v2313 /a>                          ef">old /a> = 2376 /a_aring"a&quo">failedsko extendbc>pcca h&quo">c"comme>258">2258 /a>}v2254 /a>                          gotoeef">old /a> = pu_>258">2258 /a>}v2369 /aaaa37 /a>          L258">2258 /a>}v2396 /a>  69 /aaaaaaaaaaaaef">old /a> = (&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2337 /a>  aaaaaaaa37 /a>  e2 /a>         span clas="comment"> */ /span v2328 /a> span claaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaass clasrele has been droop6d, needsko="comment"> */ /span v2369 /a> span claaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaassrestart clas las limp walkew ases pcpu_lock. /span v237tioa> span claaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaass="comment"> */ /span v233333333333333333aaaaaaaagotoeef">old /a> = chunk /a>);v2398 /a>          L258">2258 /a>}vchunk /a>);v2254 /a>          size /a> = 0,         pc=pcpu_mem_free" classs="sf">pcxtendef">old /a> = old /a> = chunk /a>);v2369 /aaaa37 /a>  f2 /a>        if (ef rf">chunk /a>);v2396 /a>  33333333aaaaaaaagotoeef">old /a> = <">pc_founsode=pcpu_chunk"s>pc_founs>pu_>258">2258 /a>}v2337 /a>  L258">2258 /a>}v22L258">2258 /a>}v2259 /a>v2392 /a>         span classhmmm... no spacesleft,ssreovend new s="srass="comment"> */ /span v2399 /a>        (&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2258 /a>}v23save /a>(&chunk /a>);v22f2 /a>        if (!nslot /a>) {v2369 /aaaachunk /a>->2376 /a_aring"a&quo">failedsko _mem_zal new s="sr&quo">c"comme>258">2258 /a>}v2396 /a>  gotoeef">old /a> = pu_>258">2258 /a>}v23L258">2258 /a>}v2258 /a>}v2399 /a>        (&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v23 /a> * sizeof(< class="srereem_zal=pcpu_mem_free" class="srereem_zalxtendef">old /a> = chunk /a>);v23gotoeef">old /a> = chunk /a>);v2258 /a>}vold /a> = <">pc_founsode=pcpu_chunk"s>pc_founs>pu_:L300">230tioa>v23save /a>(&(&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);vchunk /a>);v2392 /a>         span classpate ove,ca hcis d>lear th> _>pccss="comment"> */ /span v22f2 /save /a>(&< claspate ovess="srref="+code=map"a hrepate ovess="srn_locef">old /a> =  = 0, < claef="+code=size" class=")ref">nslot /a>) {v2298 /a>  99 /a>        (&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2269 /aaaasave /a>(&< clasallor">pc=pcpu_mem_free" clasallor">pcn_locef">old /a> = chunk /a>);v2390 /a>  chunk /a>->2376 /a_aring"a&quo">failedsko pate ove&quo">c"comme>258">2258 /a>}v2333333333gotoeef">old /a> = pu_>258">2258 /a>}v23L258">2258 /a>}vchunk /a>);v23save /a>(&(&< classs="sfmutexode=pcpu_chunk" classs="sfmutexss="ref">chunk /a>);vchunk /a>);v2392 /a>         span class66 /a> addresssre ovtvesko basesaddresssss="comment"> */ /span v23save /a>(&< trode=pcpu_chunk" trs="sref25 /a>        <_ssddr_to_p hreptrode=pcpu_chunk"_ssddr_to_p hreptrn_locef">old /a> = chunk /a>-> = 0, chunk /a>);v23save /a>(&old /a> = < trode=pcpu_chunk" trs="sd_size /a> = 0, < claef="+code=size" class=")ef">chunk /a>);v2266 /a>        return < trode=pcpu_chunk" trs="sef">chunk /a>);v230tioa>v        if (pu_:L300">230tioa>v2362 /a>        (&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);vold /a> = pu_:L300">230tioa>v23save /a>(&(&< classs="sfmutexode=pcpu_chunk" classs="sfmutexss="ref">chunk /a>);v23f2 /a>        if (nslot /a>) {v2396 /a>  9ave /a>(&< r_warning"de=pcpu_chunk" r_warningn_loce376">2376 /a_aring"a&quo">PERCPU: a: new tar failed,ap_al=%zu/slign=%zu,/&quo">c"comment"> */ /span v2337 /a>  >2396 /a>  9376">2376 /a_aring"a&quo">%s\n&quo">c"commereef">old /a> = < claef="+code=size" class="reef">old /a> = old /a> = chunk /a>);v2298 /a>  ef">old /a> = chunk /a>);v2269 /aaaaf2 /a--a>        if (chunk /a>);v2390 /a>  37 /a>  ef">old /a> = 2376 /a_aring"a&quo">PERCPU: limi_266ached,adisableawarning\n&quo">c"commeref">chunk /a>);v23L258">2258 /a>}v2366 /a>        return chunk /a>);v2258 /a>}v2394 /a>v2265 /a> span class="comment">/** /span v2376 /a> span clas _sss="sf vpc="comment">/** /span v2347 /a> span class@ cla:ap_al tend>pcc @p_mem_zal 9nnbytesefcomment">/** /span v2328 /a> span clas @align: alignpan  tend>pcc(max PAGE_SIZE)efcomment">/** /span v2369 /a> span classes pcpu_lock. /span v237tioa> span classAmem_zal zero-filled  vpccten@ clanbytes align="c"t @alignases pcpu_lock. /span v2371 /a> span classMight sleep. sMight arigger writeoutsases pcpu_lock. /span v2372 /a> span classes pcpu_lock. /span v2263 /a> span class="comment"> * CONTEXT: /span v2264 /a> span classDoes GFP_KERNEL*c: new tarases pcpu_lock. /span v2375 /a> span classes pcpu_lock. /span v2376 /a> span clas RETURNSnt"> * CONTEXT: /span v2347 /a> span clas Pv _mem_zal bc>pcctn success, NULLctn failureases pcpu_lock. /span v2328 /a> span class="comment"> */ /span v        <__ vpcpu_chunk /a> *<_sss="sf vold /a> = < cla__ode=pcpu_chunk" cla__ef">ppu_chunk /a> *old /a> = < cla__ode=pcpu_chunk" cla__ef">ppu_chunk /a> *chunk /a>);vnslot /a>) {v2366 /a>        return < classf="+code=map_alloc"a hreef="+xtendef">old /a> = < claef="+code=size" class="reef">old /a> = old /a> = chunk /a>);v2258 /a>}vold /a> = old /a> = <_sss="sf vchunk /a>);v2394 /a>v2265 /a> span class="comment">/** /span v2376 /a> span clas _sss="sfreservldf vpc="comment">/** /span v2347 /a> span class@ cla:ap_al tend>pcc @p_mem_zal 9nnbytesefcomment">/** /span v2328 /a> span clas @align: alignpan  tend>pcc(max PAGE_SIZE)efcomment">/** /span v2369 /a> span classes pcpu_lock. /span v237tioa> span classAmem_zal zero-filled  vpccten@ clanbytes align="c"t @alignses pcpu_lock. /span v2371 /a> span classfrom reservld  vpccf2 archahas set it up; o 2372 /a> span classa: new tar is servld from thesscla dy clic c>pc. sMight pcpu_lock. /span v2263 /a> span classMight arigger writeoutsases pcpu_lock. /span v2264 /a> span classes pcpu_lock. /span v2375 /a> span clas ="comment"> * CONTEXT: /span v2376 /a> span clas Does GFP_KERNEL*c: new tarases pcpu_lock. /span v2347 /a> span classes pcpu_lock. /span v2328 /a> span clas RETURNSnt"> * CONTEXT: /span v2369 /a> span clas Pv _mem_zal bc>pcctn success, NULLctn failureases pcpu_lock. /span v237tioa> span class="comment"> */ /span v        <__ vpcpu_chunk /a> *<_sss="sfreservldf vold /a> = < cla__ode=pcpu_chunk" cla__ef">ppu_chunk /a> *old /a> = < cla__ode=pcpu_chunk" cla__ef">ppu_chunk /a> *chunk /a>);vnslot /a>) {v2366 /a>        return < classf="+code=map_alloc"a hreef="+xtendef">old /a> = < claef="+code=size" class="reef">old /a> = old /a> = chunk /a>);v2258 /a>}vchunk /a>);v2376 /a> span class="comment">/** /span v2347 /a> span class clasre234im - re234im fully allo t"> *s, workqueue func tar="comment">/** /span v2328 /a> span clas @work:sunss="="comment">/** /span v2369 /a> span clas="comment">/** /span v237tioa> span classRe234im ef= fully allo t"> *s except372 /thesfirdt2oneases pcpu_lock. /span v2371 /a> span classes pcpu_lock. /span v2372 /a> span class="comment"> * CONTEXT: /span v2263 /a> span classworkqueue  ontextases pcpu_lock. /span v2264 /a> span class="comment"> */ /span v2290 /25 /a>        < clasre234imcode=map_alloc"a hrere234imxtend_area_map /a>(struct pcpu_chunk /a> *chunk /a>);vnslot /a>) {v23save /a>(&old /a> = chunk /a>);v22_area_map /a>(struct pcpu_chunk /a> *p=_k_irqsave /a>(&< clasde=pcpu_chunk_slot" clas lass="s"ew_size /a> = pu_ - 1]ef">chunk /a>);v22_area_map /a>(struct pcpu_chunk /a> *chunk /a>);v230tioa>v2399 /a>        (&< classs="sfmutexode=pcpu_chunk" classs="sfmutexss="ref">chunk /a>);v2362 /a>        (&< clasrelef="+code=chunk" clasreless="ref">chunk /a>);vchunk /a>);v23save /a>(&old /a> =  = 0, reef">old /a> = nslot /a>) {v2369 /aaaachunk /a>->old /a> = chunk /a>->chunk /a>);v2206 /a>v2337 /a>  e2 /a>         span classspare/thesfirdt2oneass="comment"> */ /span v2298 /a>  f2 /a>        if (old /a> = re_area_map /a>(struct reef">old /a> = chunk /a>);v2269 /aaaaaaaaaaaa ontinue>258">2258 /a>}v230tioa>v233333333325 /a>        (&chunk /a>->(&chunk /a>);v23L258">2258 /a>}vchunk /a>);v23save /a>(&(&< clasrelef="+code=chunk" clasreless="ref">chunk /a>);vchunk /a>);v239ave /a>(&old /a> = (&old /a> = nslot /a>) {v2337 /a>  ef">old /a> = < clasdepate ovess="srref="+code=map"a hredepate ovess="srxtendef">old /a> = old /a> = chunk /a>);v2298 /a>  99 /a>        old /a> = chunk /a>);v22L258">2258 /a>}v230tioa>v2399 /a>        (&< classs="sfmutexode=pcpu_chunk" classs="sfmutexss="ref">chunk /a>);v2258 /a>}vchunk /a>);v2264 /a> span class="comment">/** /span v2375 /a> span clas allor vpc="comment">/** /span v2376 /a> span clas @ptr:*pounk: sko d>pcc @pallo="comment">/** /span v2347 /a> span classes pcpu_lock. /span v2328 /a> span clas Fllo  vpc @ptrases pcpu_lock. /span v2369 /a> span clas="comment">/** /span v237tioa> span class="comment"> * CONTEXT: /span v2371 /a> span classC1">be called from atolic  ontextases pcpu_lock. /span v2372 /a> span class="comment"> */ /span v                <__ vpcpu_chunk /a> *< trode=pcpu_chunk" trs="srf">chunk /a>);vnslot /a>) {v23290 /cpu_chunk /a> *chunk /a>);v23_area_map /a>(struct pcpu_chunk /a> *chunk /a>);v23unsign="clongeef">old /a> = chunk /a>);v22unk_size /a> = 0, chunk /a>);v2259 /a>v23f2 /a>        if (!< trode=pcpu_chunk" trs="srf">chunk /a>);v233333333366 /a>ef">chunk /a>);v2258 /a>}v23save /a>(&old /a> = < trode=pcpu_chunk" trs="sref">chunk /a>);v2394 /a>v239u_chunk /a> *        <_sp hreptr_to_sddrode=pcpu_chunk"_sp hreptr_to_sddrxtendef">old /a> = < trode=pcpu_chunk" trs="sref">chunk /a>);v2206 /a>v23save /a>(&(&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2258 /a>}v2399 /a>        old /a> = chunk /a>);v23 /a> * sizeof(         *chunk /a>->chunk /a>);vchunk /a>);v2362 /a>        < clasallor">pc=pcpu_mem_free" clasallor">pcn_locef">old /a> = chunk /a>);vchunk /a>);v23e2 /a>         span classf2   _>p more/th/a>oneafully allo t"> *s, wake up grim rea;v */ /span v23f2 /a>        if (chunk /a>->nslot /a>) {v2396 /a>  _area_map /a>(struct pcpu_chunk /a> *chunk /a>);v2397 /a>v2298 /a>  9ave /a>(&old /a> = < oef="+code=flags" oes="sd_k_irqsave /a>(&< clasde=pcpu_chunk_slot" clas lass="s"ew_size /a> = pu_ - 1]reef">old /a> = 2397 /a>v2269 /aaaaaaaaaaaaf2 /save /a>(&< oef="+code=flags" oes="s !ef25 /a>        nslot /a>) {v2390 /a>  37 /a>  L313">23save /a>(&(&< clasre234im_workode=pcpu_chunk" clasre234im_worklistref">chunk /a>);v23333333333333333333333333breakef">chunk /a>);v2398 /a>          L258">2258 /a>}v23L258">2258 /a>}v2394 /a>v239u_chunk /a> *(&< clasrelef="+code=chunk" clasreless="reef">old /a> = chunk /a>);v2258 /a>}vold /a> = old /a> = chunk /a>);v2258 /a>}v2369 /a> span class="comment">/** /span v237tioa> span classis_kernelr v2 vpc="comment">/** /span v2371 /a> span class@addr:saddresssko temps=comment">/** /span v2372 /a> span class=comment">/** /span v2263 /a> span classTemp whe 2 vpc. sModules=comment">/** /span v2264 /a> span clas L382">2 vpcs _>p not  onsidor>d. sF2 /those, uses=comment">/** /span v2375 /a> span clas is_moduler v2376 /a> span classes pcpu_lock. /span v2347 /a> span clas RETURNSnt"> * CONTEXT: /span v2328 /a> span clas %areraf2 @addr is from in-kernel L382">2 vpc, %falsa o 2369 /a> span class="comment"> */ /span v->->old /a> =  */ /span vnslot /a>) {vold /a> = 2258 /a>}v23 ons_map /a>(struct < cla__ode=pcpu_chunk" cla__ef">ppu_chunk /a> *_ claef="+code=size"a382">_ clas="sref25 /a>        <_sper_a h_end+code=map_used"_sper_a h_ends="sr-apu_chunk /a> *<_sper_a h_start+code=map_used"_sper_a h_starts="sef">chunk /a>);v22290 /25 /a>        <__ vpcpu_chunk /a> *        <_ssddr_to_p hreptrode=pcpu_chunk"_ssddr_to_p hreptrn_locef">old /a> = 

chunk /a>);v23unsign="cunk_size /a> = 0, ef">chunk /a>);v2206 /a>v23save /a>(&old /a> = ref">nslot /a>) {v2298 /a> 290 /cpu_chunk /a> * old /a> = old /a> = ref">chunk /a>);v2259 /a>v2390 /a> f2 /d290 /*)25 /a> efpu_chunk /a> * * = 0, _ claef="+code=size"a382">_ clas="srnt"> */ /span v23333333333333333366 /a> return chunk /a>);v23L258">2258 /a>}v2258 /a>}v23e2 /a> span classon UP, can'tadistinguish from o 2vars, always falsa ss="comment"> */ /span v2366 /a> return chunk /a>);v2258 /a>}v2397 /a>v2328 /a> span class="comment">/** /span v2369 /a> span clas er_a h_ tr_to_physs- onvert aranslzal b v/** /span v237tioa> span class@addr:sth> _ddresssko be onvertedsko physical addressxtcomment">/** /span v2371 /a> span classes pcpu_lock. /span v2372 /a> span classGiven @addr which is dor>for>nceablea_ddresssobtain="cvia>oneaofses pcpu_lock. /span v2263 /a> span class v2264 /a> span clas _ddress. The caller is responsiblea72 /ensuring @addr L38yssvali"="comment">/** /span v2375 /a> span clas until this func tar finishesases pcpu_lock. /span v2376 /a> span classes pcpu_lock. /span v2347 /a> span class vntlyses pcpu_lock. /span v2328 /a> span clas supports ei 2369 /a> span clas and, from thesse ond>one, thesbacking cmem_za2 /(curr>ntly ei 237tioa> span classkm) providls aranslzatarases pcpu_lock. /span v2371 /a> span classes pcpu_lock. /span v2372 /a> span classTh> _ddr can be aranlzal bsimply wi 2263 /a> span classfirdt2 clas. But2thescurr>nt urn reflects betk: shows v2264 /a> span clas _ctually works, and>thesverifiew tar can discover bo < bugs un v2375 /a> span clas cmem_za2 /itself and> er_a h_ tr_to_phys() callers. So we keepscurr>ntefs pcpu_lock. /span v2376 /a> span clas urn ases pcpu_lock. /span v2347 /a> span classes pcpu_lock. /span v2328 /a> span clas RETURNSnt"> * CONTEXT: /span v2369 /a> span clas Th> physical address372 /@addrases pcpu_lock. /span v10asm vaL369">2369 /a> span class="comment/pre>

2369 /ado399""sre18/a8/16c085cdf0b99a169e31e287dbf6f25fe7a7_3/10ass>_lock. /span v10aam vaL>        if (ppu_chunk /a> *< er_a h_ tr_to_physode=pcpu_chunk" er_a h_ tr_to_physn_loc290 /cpu_chunk /a> * */ /span v10aam vaf">nslot /a>) {v10aam vaL313">23290 /25 /a>        <__ vpcpu_chunk /a> *        <_ssddr_to_p hreptrode=pcpu_chunk"_ssddr_to_p hreptrn_locef">old /a> = 

chunk /a>);v10a4m vaL313">23save /a>(&->chunk /a>);v10aam vaL395">23unsign="clongeef">old /a> = old /a> = chunk /a>);v10a6m vaL395">23unsign="cunk_size /a> = 0, ef">chunk /a>);v10aam vaL397">2397 /a>v10a8m vaL313">23s328">2328 /a> span classes pcpu_lock. /span v10aam vaL369">2369 /a> span claaaaaaaaas Th> fomemwing temp ar unit_emw/high isn'ta_arictlyses pcpu_lock. /span v10c#m vaL369">2369 /a> span claaaaaaaaas necessary but will spe="c/p3lookups tendddressls whichses pcpu_lock. /span v10cam vaL371">2371 /a> span claaaaaaaaas ar>n'taun thesfirdt2 clasases pcpu_lock. /span v10cam vaL372">2372 /a> span claaaaaaaaass="comment"> */ /span v10cam vaL313">23save /a>(& old /a> =

old /a> = < clasreweunit_a hode=pcpu_chunk" clasreweunit_a hss="re0ref">chunk /a>);v10c4m vaL313">23save /a>(& old /a> =

old /a> = < clashigheunit_a hode=pcpu_chunk" clashigheunit_a hss="rf">chunk /a>);v10cam vaL395">2369 /aaaaaaaaaaaaaaaaaaaaaaaaaef">old /a> = < clasunit_pageef="+code=flags" clasunit_pageextenref">chunk /a>);v10c6m vaL395">23f2 /dunsign="clong)25 /a> efpu_chunk /a> *chunk /a>);v10cam vaL337">2337 /dunsign="clong)25 /a> *nslot /a>) {v10cam vaL298">2298 /a> 9ave /a>(&old /a> = ref">nslot /a>) {v10cam vaL269">2269 /aaaaaaaaaaaa290 /cpu_chunk /a> * old /a> = old /a> = ref">chunk /a>);v10c#m vaL397">2397 /a>v10cam vaL311">233333333333333333f2 /save /a>(&efpu_chunk /a> * * = 0, nslot /a>) {v10cam vaL392">2398 /a> 98 /a> 9ave /a>(&chunk /a>);v10c3m vaL392">2398 /a> 98 /a> breakef">chunk /a>);v10c4m vaL392">2398 /a> L258">2258 /a>}v10cam vaL395">2369 /aaaaL258">2258 /a>}v10c6m vaL395">23L258">2258 /a>}v10cam vaL397">2397 /a>v10c8m vaL395">23f2 /9ave /a>(&nslot /a>) {v10cam vaL269">2269 /aaaaf2 /a9ave /a>(&old /a> = */ /span v10c#m vaL311">23333333333333333366 /a> return <__paode=pcpu_chunk"__ cn_locef">old /a> = chunk /a>);v10cam vaL311">2333333333elsef">chunk /a>);v10cam vaL392">2398 /a> 66 /a> return < age_to_physode=pcpu_chunk" age_to_physn_locef">old /a> = old /a> = chunk /a>);v10c3m vaL392">2398 /a> 98 /a> ef">old /a> = old /a> = chunk /a>);v10c4m vaL392">23}3elsef">chunk /a>);v10cam vaL395">2369 /aaaa66 /a> return < age_to_physode=pcpu_chunk" age_to_physn_locef">old /a> = < classddr_to_pageode=pcpu_chunk" classddr_to_pagen_locef">old /a> = chunk /a>);v10cam vaL396">2396 /a> 98 /a> ef">old /a> = old /a> = chunk /a>);v10c7m vaL258">2258 /a>}v10cam va258">2258 /a>}v10cam vaL369">2369 /a> span class="comment">/** /span v10c#m vaL347">2347 /a> span class classs="sfss="sfinfo - _mem_zal v/** /span v10cam vaL371">2371 /a> span class@nr_groups:sth> number tengroups="comment">/** /span v10cam vaL372">2372 /a> span class@nr_units:sth> number tenunits="comment">/** /span v10cam vaL263">2263 /a> span clas="comment">/** /span v10cam vaL264">2264 /a> span clas Amem_zal ai which is large enough372 /@nr_groupsngroups ontaining="comment">/** /span v10cam vaL375">2375 /a> span clas @nr_unitsnunits. The 66 /a>l bci'sngroups[0].clasmap*pounks ko 10cam vaL376">2376 /a> span clas ulasmap*array which is longeenough372 /@nr_unitsnand>filled wi 10cam vaL347">2347 /a> span classNR_CPUS. It'snthe caller'snresponsibilitysko initialclanulasmapses pcpu_lock. /span v10cam vaL328">2328 /a> span clas pounk: steno 10cam vaL369">2369 /a> span clas="comment">/** /span v10c#m vaL328">2328 /a> span clas RETURNSnt"> * CONTEXT: /span v10cam vaL371">2371 /a> span classPounk: sko th> _mem_zal b classs="sfinfo tn success, NULLctnt"> * CONTEXT: /span v10cam vaL372">2372 /a> span classfailureases pcpu_lock. /span v10cam vaL263">2263 /a> span class="comment"> */ /span v10cam va_area_map /a>(struct pc return <__initode=pcpu_chunk"__initef">ppu_chunk /a> *< classs="sfss="sfinfoode=pcpu_chunk" classs="sfss="sfinfoef">(unk_size /a> = 0, chunk /a>);v10cam vaL395">2369 /aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaunk_size /a> = 0, */ /span v10cam vaf">nslot /a>) {v10cam vaL337">23_area_map /a>(struct pcef">old /a> = chunk /a>);v10c8m vaL313">23su_chunk /a> *ppu_chunk /a> *old /a> = chunk /a>);v10cam vaL269">22290 /cpu_chunk /a> *< trode=pcpu_chunk" trs="sef">chunk /a>);v10c#m vaL395">23fnk_size /a> = 0, ef">chunk /a>);v10cam vaf">chunk /a>);v10cam vaL362">2362 /a> ( claof(cef">old /a> = = 0, old /a> = chunk /a>->chunk /a>);v10c3m vaL392">2398 /a> 9825 /a> <_sslignof__ode=pcpu_chunk"_sslignof__n_locef">old /a> = chunk /a>->old /a> = chunk /a>);v10c4m vaL313">23save /a>(& old /a> = chunk /a>->old /a> = chunk /a>);v10cam vaf">chunk /a>);v10cam vaL396">239ave /a>(&< trode=pcpu_chunk" trs="sref25 /a> old /a> = old /a> = chunk /a>);v10cam vaL337">23f2 /a> if (!< trode=pcpu_chunk" trs="srf">chunk /a>);v10cam vaL298">2298 /a> 66 /a> return ef">chunk /a>);v10cam vaL399">2399 /a> chunk /a>);v10c#m vaL396">239ave /a>(&< trode=pcpu_chunk" trs="sr+ef25 /a> chunk /a>);v10cam vaf">chunk /a>);v10cam vaL362">2362 /a> chunk /a>->old /a> = chunk /a>);v10cam vaf">chunk /a>);v10c4m vaL313">2372 /cef">old /a> = ref0_apu_chunk /a> *reew_apu_chunk /a> * *++rf">chunk /a>);v10cam vaL395">2369 /aaaachunk /a>->chunk /a>->old /a> = ]ref25 /a> chunk /a>);v10cam vaL206">2206 /a>v10c7m vaL313">23save /a>(&chunk /a>-> chunk /a>);v10c8m vaL313">23su_chunk /a> *chunk /a>-><_ssi_ claef="+code=size"_ssi_ class="aef25 /a> old /a> = chunk /a>);v10cam vaL259">2259 /a>v10c#m vaL313">2366 /a> return chunk /a>);v10c1m vaL258">2258 /a>}v10cam va258">2258 /a>}v10cam vaL263">2263 /a> span class="comment">/** /span v10cam vaL264">2264 /a> span clas clasallor"s="sfinfo - allo v/** /span v10cam vaL375">2375 /a> span clas @ai:b classs="sfinfo @pallo="comment">/** /span v10cam vaL376">2376 /a> span classes pcpu_lock. /span v10cam vaL347">2347 /a> span classFllo @ai which wcs _mem_zal bbys classs="sfss="sfinfo()ases pcpu_lock. /span v10cam vaL328">2328 /a> span class="comment"> */ /span v10cam va290 /25 /a> <__initode=pcpu_chunk"__initef">ppu_chunk /a> *< clasallor"s="sfinfoode=pcpu_chunk" clasallor"s="sfinfoef">( area_map /a>(struct pcef">old /a> = chunk /a>);v10c#m vaf">nslot /a>) {v10c1m vaL399">2399 /a> old /a> = <__paode=pcpu_chunk"__ cn_locef">old /a> = old /a> = chunk /a>-><_ssi_ claef="+code=size"_ssi_ class=")ef">chunk /a>);v10cam vaL258">2258 /a>}v10cam vaf">chunk /a>);v10cam vaL264">2264 /a> span class="comment">/** /span v10cam vaL375">2375 /a> span clas a hredumpr"s="sfinfo - prfnk_out2informzatar about2 classs="sfinfoefcomment">/** /span v10cam vaL376">2376 /a> span clas @lvl: loglevelses pcpu_lock. /span v10cam vaL347">2347 /a> span class@ai:bcmem_zatar info @pdumpses pcpu_lock. /span v10cam vaL328">2328 /a> span classes pcpu_lock. /span v10cam vaL369">2369 /a> span clas Prfnk_out2informzatar about2@ai using loglevel @lvlases pcpu_lock. /span v11asm vaL369">2369 /a> span class="commentlock. /span v11aam vaL382">2v90 /25 /a> old /a> = chunk /a>);v110am vaL392">2398 /a> 98 /a> 3 ons_m area_map /a>(struct pcef">old /a> = chunk /a>);v11aam vaf">nslot /a>) {v11a4m vaL313">23fnk_size /a> = 0, old /a> = old /a> = chunk /a>);v11aam vaL395">23charpef">old /a> = 2369 /a_aring">"--------"="commeef">chunk /a>);v11a6m vaL395">23fnk_size /a> = 0, ref0reef">old /a> = ref0_f">chunk /a>);v1107m vaL313">23fnk_size /a> = 0, old /a> = chunk /a>);v110am vaL298">22unk_size /a> = 0, old /a> = span classunitsnporsas="s,sas="ssnporsaL39ass="commentlock. /span v110am vaL259">2259 /a>v111#m vaL396">239ave /a>(& chunk /a>->chunk /a>);v1111m vaL399">23while/cef">old /a> = chunk /a>);v111am vaL392">2398 /a> size /a> = 0, chunk /a>);v111am vaf">chunk /a>);v11c4m vaL313">23save /a>(& chunk /a>);v11cam vaL395">23while/cef">old /a> = chunk /a>);v111am vaL396">2396 /a> ef">old /a> = chunk /a>);v1117m vaL313">23save /a>(&(&old /a> = old /a> = 2369 /a_aring">'\0'="commeef">chunk /a>);v111am va258">2258 /a>}v111am vaL399">2399 /a> chunk /a>-> chunk /a>->chunk /a>);v112#m vaL396">239ave /a>(& if (chunk /a>);v1121m vaL399">2399 /a> old /a> = chunk /a>);v112am va258">2258 /a>}v11c3m vaL392">23ap /a>(struct 2369 /a_aring">"%s cla-as="s: s%zu r%zu d%zu u%zu as="s=%zu*%zu"="commerf">chunk /a>);v11c4m vaL392">2398 /a> ef">old /a> = chunk /a>->_ claef="+code=size"a382">_ clas="srf25 /a> chunk /a>->chunk /a>->chunk /a>);v11cam vaL395">2369 /aaa25 /a> chunk /a>->chunk /a>-> chunk /a>->chunk /a>->chunk /a>);v112am vaL206">2206 /a>v1127m vaL313">2372 /cef">old /a> = * *chunk /a>-> *nslot /a>) {v112am vaL298">2298 /a> ons_m area_map /a>(struct pcef">old /a> = (&chunk /a>-> *chunk /a>);v11cam vaL269">2269 /aaaafnk_size /a> = 0, ref0reef">old /a> = ref0_f">chunk /a>);v113#m vaL397">2397 /a>v11cam vaL311">2333333333ef">old /a> = old /a> = chunk /a>-> chunk /a>);v11cam vaL392">2398 /a> 72 /cef">old /a> = r+ef25 /a> chunk /a>-> chunk /a>);v11c3m vaL392">2398 /a> size /a> = 0, reew_apu_chunk /a> *_apu_chunk /a> *++ref">nslot /a>) {v1134m vaL392">2398 /a> f2 /acef">old /a> = re#37;f25 /a> nslot /a>) {v11cam vaL395">2369 /aaaa>2398 /a> size /a> = 0, = 0, 2369 /a_aring">"\n"="comme)ef">chunk /a>);v11cam vaL396">2396 /a> 98 /a> a> size /a> = 0, 2369 /a_aring">"%s cla-as="s: "="commer ef">old /a> = chunk /a>);v113am vaL337">2337 /////////////L258">2258 /a>}v113am vaL298">2298 /a> > size /a> = 0, = 0, 2369 /a_aring">"[%0*d] "="commer ef">old /a> = old /a> = chunk /a>);v113am vaL259">2259 /a>v114#m vaL311">23333333333333333372 /cef">old /a> = r+ef25 /a> *reew_apu_chunk /a> *_apu_chunk /a> *++rf">chunk /a>);v114am vaL311">23333333333333333333333333f2 /9ave /a>(&chunk /a>->]r!ef25 /a> chunk /a>);v114am vaL392">2398 /a> 98 /a> 3 size /a> = 0, = 0, 2369 /a_aring">"%0*d "="commer ef">old /a> = chunk /a>);v1143m vaL392">2398 /a> 98 /a> 8 /a> 3 size /a> = 0, chunk /a>->])ef">chunk /a>);v1144m vaL392">2398 /a> elsef">chunk /a>);v114am vaL395">2369 /aaaaaaaaaaaaaaaaaaaaaaaaaaaasize /a> = 0, = 0, 2369 /a_aring">"%s "="commer ef">old /a> = chunk /a>);v114am vaL396">2396 /a> L258">2258 /a>}v114am vaL337">23L258">2258 /a>}v1148m vaL313">23su_chunk /a> * = 0, 2369 /a_aring">"\n"="comme)ef">chunk /a>);v11cam vaL258">2258 /a>}v115#m vaL397">2397 /a>v11cam vaL371">2371 /a> span class="comment">/** /span v11cam vaL372">2372 /a> span class class6 /p_firdt_a hre - initialclanthesfirdt2 v/** /span v11cam vaL263">2263 /a> span clas @ai:b classs="sfinfo describing howsko pv/** /span v115am vaL264">2264 /a> span clas @base_sddr:ca hpl bcddressxtcomment">/** /span v115am vaL375">2375 /a> span clasxtcomment">/** /span v115am vaL376">2376 /a> span clas Initialclanthesfirdt2 vxtcomment">/** /span v115am vaL347">2347 /a> span class v/** /span v115am vaL328">2328 /a> span clas s6 /p3pathases pcpu_lock. /span v115am vaL369">2369 /a> span clas="comment">/** /span v116am vaL370">237tioa> span class@ai containsnall2informzatar necessary ko initialclanthesfirdt="comment">/** /span v116am vaL371">2371 /a> span classa hre and> rimanthesdy clics v116am vaL372">2372 /a> span classes pcpu_lock. /span v116am vaL263">2263 /a> span clas @airef">a382">_ cla isskhesscla of L382"> pv116am vaL264">2264 /a> span classes pcpu_lock. /span v116am vaL375">2375 /a> span clas @airef">reserved_ cla,3f2 non-zero, specifiesskhesamounk_of byals toefcomment">/** /span v116am vaL376">2376 /a> span clas reserve afk: skhess382"> crea in thesfirdt2 clasa This reservesxtcomment">/** /span v116am vaL347">2347 /a> span classthesfirdt2 clas suchsthat it'snavailableaonly khrough3reservedxtcomment">/** /span v116am vaL328">2328 /a> span clas pv116am vaL369">2369 /a> span clas s382"> creas tn architecturls wheranthescddressing model hasxtcomment">/** /span v117am vaL370">237tioa> span classlimial boffset rangea72 /symbol3reem_zatarssko guarantee modulextcomment">/** /span v117am vaL371">2371 /a> span classpv117am vaL372">2372 /a> span classes pcpu_lock. /span v117am vaL263">2263 /a> span clas @airef">dyn_ cla dek: mL37ssth> number tenbyals availablea72 /dy clicses pcpu_lock. /span v117am vaL264">2264 /a> span clas _mem_zatar in thesfirdt2 clasa The crea between @airef">a382">_ cla +ses pcpu_lock. /span v117am vaL375">2375 /a> span clas @airef">reserved_ cla + @airef">dyn_ cla and>@airef">unit_ cla is unusedases pcpu_lock. /span v117am vaL376">2376 /a> span classes pcpu_lock. /span v117am vaL347">2347 /a> span class@airef">unit_ cla specifiessunit cla and>mudt2b> _mign="cko PAGE_SIZEses pcpu_lock. /span v117am vaL328">2328 /a> span clas and>equalcko 2 /large skhan @airef">a382">_ cla + @airef">reserved_ cla +ses pcpu_lock. /span v117am vaL369">2369 /a> span clas @airef">dyn_ claases pcpu_lock. /span v118am vaL370">237tioa> span classes pcpu_lock. /span v118am vaL371">2371 /a> span class@airef">atomf cla isskhes_mem_zatar atom cla and>used cs _mignm>ntefs pcpu_lock. /span v118am vaL372">2372 /a> span classf2 /vm creasases pcpu_lock. /span v11cam vaL263">2263 /a> span classes pcpu_lock. /span v11cam vaL264">2264 /a> span clas @airef">as="sf cla isskhes_mem_zatar cla and>always>multipleaofses pcpu_lock. /span v11cam vaL375">2375 /a> span clas @airef">atomf claa This is large skhan @airef">atomf cla ifses pcpu_lock. /span v11cam vaL376">2376 /a> span clas>@airef">unit_ cla is large skhan @airef">atomf claases pcpu_lock. /span v11cam vaL347">2347 /a> span classes pcpu_lock. /span v11cam vaL328">2328 /a> span clas @airef">nr_groupsnand>@airef">groupsndescribe virtualcmemory layout2ofses pcpu_lock. /span v118am vaL369">2369 /a> span clas pv119am vaL370">237tioa> span classscla group. Dy clicsVM creas will b> _mem_zal baccording to 119am vaL371">2371 /a> span classgroupings. If @airef">nr_groupsnis zero, a singla group ontaining="comment">/** /span v119am vaL372">2372 /a> span classall unitsnis 72 umedases pcpu_lock. /span v119am vaL263">2263 /a> span classes pcpu_lock. /span v11cam vaL264">2264 /a> span clas Th> caller should have m hpl bthesfirdt2 clas at @base_sddrnandses pcpu_lock. /span v11cam vaL375">2375 /a> span clas copil bs382"> dzaa to each unitases pcpu_lock. /span v11cam vaL376">2376 /a> span classes pcpu_lock. /span v11cam vaL347">2347 /a> span classIf thesfirdt2 clas endsc/p3wi < both3reservednand>dy clicscreas, itefs pcpu_lock. /span v11cam vaL328">2328 /a> span clas is servednby two2 class - one ko serve the coress382"> cnd>reservedxtcomment">/** /span v11cam vaL369">2369 /a> span clas creas cnd>the o /** /span v12asm vaL369">2369 /a> span clas and> age m h but2usesndifferan crea _mem_zatar m h ko stay awayxtcomment">/** /span v120am vaL371">2371 /a> span classfrom each o /** /span v120am vaL372">2372 /a> span classand>availablea72 /dy clic _mem_zatar lika any o 120am vaL263">2263 /a> span classes pcpu_lock. /span v120am vaL264">2264 /a> span clas RETURNSnt"> * CONTEXT: /span v120am vaL375">2375 /a> span clas 0 tn success, -errno tn failureases pcpu_lock. /span v120am vaL376">2376 /a> span class="commentlock. /span v1207m vafnk_size /a> = 0, <__initode=pcpu_chunk"__initef">ppu_chunk /a> *< class6 /p_firdt_a href="+code=chunk"pclass6 /p_firdt_a hren_loc ons_m area_map /a>(struct pcef">old /a> = chunk /a>);v120am vaL298">2298 /a> > 290 /cpu_chunk /a> *chunk /a>);v120am vaf">nslot /a>) {v121#m vaL396">23s382"> charpef">old /a> = chunk /a>);v1211m vaL399">23s382"> fnk_size /a> = 0, *]rsize /a> = 0, <__initdzaaode=pcpu_chunk"__initdzaan_loef">chunk /a>);v121am vaL392">23s382"> fnk_size /a> = 0, *]rsize /a> = 0, <__initdzaaode=pcpu_chunk"__initdzaan_loef">chunk /a>);v1213m vaL392">23ap /a>(struct ppu_chunk /a> *chunk /a>->chunk /a>);v12c4m vaL313">23save /a>(&ppu_chunk /a> *< cla_ umode=pcpu_chunk" cla_ umss="ref25 /a> chunk /a>->_ claef="+code=size"a382">_ clas="sr+_size /a> = 0, chunk /a>->chunk /a>);v12cam vaL395">23 area_map /a>(struct * * ef">chunk /a>);v121am vaL396">23unsign="clongecef">old /a> = ef">chunk /a>);v1217m vaL313">23save /a>(&pcef">old /a> = ef">chunk /a>);v1218m vaL396">23unsign="clongecef">old /a> = ef">chunk /a>);v121am vaL399">23unsign="cfnk_size /a> = 0, ef">chunk /a>);v122#m vaL395">23fnk_cef">old /a> = ef">chunk /a>);v1221m vaL399">23fnk_size /a> = 0, old /a> = reef">old /a> = chunk /a>);v122am va258">2258 /a>}v12c3m vaL392">23ap /a>(struct = 0, old /a> = old /a> = chunk /a>);v12c4m vaf">chunk /a>);v12cam va#defL39apu_chunk /a> * = 0, 2298 /a> > \f">chunk /a>);v1226m vaL395">23f2 /9ave /a>(& = 0, 2298 /a> > \f">chunk /a>);v122am vaL337">2337 /////su_chunk /a> *2369 /a_aring">"PERCPU: fail="cko initialcla,re#37;s"="commer #aond); \f">chunk /a>);v122am vaL298">2298 /a> su_chunk /a> *2369 /a_aring">"PERCPU: a hspossiblermask=%s\n"="commereef">old /a> = chunk /a>);v12cam vaL269">2269 /aaaaap /a>(struct reef">old /a> = chunk /a>);v123#m vaL311">2333333333ef">old /a> = > \f">chunk /a>);v12cam vaL311">23} a> > \f">chunk /a>);v12cam va}3while/c0rf">chunk /a>);v123am vaf">chunk /a>);v1234m vaL392">23e2 /a> span classsanity checksass="commentlock. /span v12cam vaL395">23pu_chunk /a> * = 0, chunk /a>->chunk /a>);v12cam va#ifdef3pu_chunk /a> *chunk /a>);v1237m vaL313">23save /a>(& if (!chunk /a>->_ claef="+code=size"a382">_ clas="s)ef">chunk /a>);v1238m vaL313">23su_chunk /a> * = 0, <__;v<_classtartode=pcpu_chunk"__;v<_classtartss="ae_irq ~su_chunk /a> *chunk /a>);v123am va#endiff">chunk /a>);v124#m vaL396">239ave /a>(& if (!chunk /a>);v1241m vaL399">2399 /a> = 0, *chunk /a>);v124am vaL362">2362 /a> = 0, chunk /a>->chunk /a>);v1243m vaL392">23ap /a>(struct = 0, chunk /a>->chunk /a>);v1244m vaL313">23save /a>(& = 0, chunk /a>->chunk /a>);v124am vaL395">23pu_chunk /a> * = 0, chunk /a>->chunk /a>);v124am vaL396">23pu_chunk /a> * = 0, < clasverifyr"s="sfinfoode=pcpu_chunk" clasverifyr"s="sfinfon_loceize /a> = 0, chunk /a>);v124am vaf">chunk /a>);v1248m vaL313">23s2 /a> span classprocess group informzatar and build onfig aablesbaccordinglyass="commentlock. /span v124am vaL399">2399 /a> ref25 /a> = 0, chunk /a>->old /a> = [0]))ef">chunk /a>);v125#m vaL396">239ave /a>(&ref25 /a> = 0, chunk /a>->old /a> = [0]))ef">chunk /a>);v1251m vaL399">2399 /a> ref25 /a> = 0, old /a> = [0]))ef">chunk /a>);v125am vaL362">2362 /a> ref25 /a> = 0, old /a> = [0]))ef">chunk /a>);v125am vaf">chunk /a>);v1254m vaL313">2372 /cef">old /a> = ref0_apu_chunk /a> *reew_apu_chunk /a> * *++rf">chunk /a>);v125am vaL395">2369 /aaaaef">old /a> = [pu_chunk /a> *]ref25 /a> chunk /a>);v125am vaL206">2206 /a>v1257m vaL313">23save /a>(&< claslow_unit_a hode=pcpu_chunk" claslow_unit_a hn_lo/ef25 /a> chunk /a>);v1258m vaL313">23su_chunk /a> * chunk /a>);v125am vaL259">2259 /a>v1260m vaL313">2372 /cef">old /a> = old /a> = ref0_apu_chunk /a> * *chunk /a>-> *old /a> = r+ef25 /a> nslot /a>) {v126am vaL311">2333333333 ons_m area_map /a>(struct pcef">old /a> = (&chunk /a>-> *chunk /a>);v126am va258">2258 /a>}v1263m vaL392">2398 /a> ef">old /a> = [pu_chunk /a> * chunk /a>->chunk /a>);v1264m vaL392">2398 /a> ef">old /a> = [pu_chunk /a> * chunk /a>-> chunk /a>->chunk /a>);v126am vaf">chunk /a>);v126am vaL396">2396 /a> 72 /cef">old /a> = * *chunk /a>-> *nslot /a>) {v126am vaL337">2337 /////////////ef">old /a> = refpu_chunk /a> *chunk /a>->chunk /a>);v126am vaL298">2298 /a> > f2 /9ave /a>(&reef25 /a> chunk /a>);v126am vaL269">2269 /aaaaL311">2333333333 ontinueef">chunk /a>);v127#m vaL397">2397 /a>v127am vaL311">233333333333333333pu_chunk /a> * = 0, regw_apu_chunk /a> *chunk /a>);v127am vaL392">2398 /a> 9ave /a>(& if (! = 0, ))ef">chunk /a>);v1273m vaL392">2398 /a> pu_chunk /a> * = 0, [pu_chunk /a> *]r!ef25 /a> chunk /a>);v1274m vaf">chunk /a>);v127am vaL395">2369 /aaaaaaaaaaaaef">old /a> = [pu_chunk /a> *]ref25 /a> r+eef">old /a> = chunk /a>);v127am vaL396">2396 /a> 98 /a> aef">old /a> = [pu_chunk /a> *]ref25 /a> chunk /a>->old /a> = chunk /a>->chunk /a>);v127am vaf">chunk /a>);v127am vaL298">2298 /a> > s2 /a> span classdek: mL37 low/high unit_a hass="commentlock. /span v127am vaL269">2269 /aaaaL311">23f2 /9ave /a>(&< claslow_unit_a hode=pcpu_chunk" claslow_unit_a hn_lo/eef25 /a> 128#m vaL311">233333333333333333a> aef">old /a> = [pu_chunk /a> *]reew_apu_chunk /a> *[pu_chunk /a> *< claslow_unit_a hode=pcpu_chunk" claslow_unit_a hn_lo]rf">chunk /a>);v128am vaL311">23333333333333333333333333save /a>(&< claslow_unit_a hode=pcpu_chunk" claslow_unit_a hn_lo/ef25 /a> ef">chunk /a>);v128am vaL392">2398 /a> f2 /9ave /a>(&< clashigh_unit_a hode=pcpu_chunk" clashigh_unit_a hn_lo/eef25 /a> 1283m vaL392">2398 /a> 98 /ef">old /a> = [pu_chunk /a> *]regw_apu_chunk /a> *[pu_chunk /a> *< clashigh_unit_a hode=pcpu_chunk" clashigh_unit_a hn_lo]rf">chunk /a>);v1284m vaL392">2398 /a> su_chunk /a> * ef">chunk /a>);v128am vaL395">2369 /aaaaL258">2258 /a>}v128am vaL396">23L258">2258 /a>}v1287m vaL313">23save /a>(&< clasnr_unitsode=pcpu_chunk" clasnr_unitsn_lo/ef25 /a> ef">chunk /a>);v12cam vaf">chunk /a>);v128am vaL399">2399 /a> = 0, )f">chunk /a>);v129#m vaL311">2333333333ef">old /a> = = 0, [pu_chunk /a> *]reef25 /a> chunk /a>);v129am vaf">chunk /a>);v129am vaL362">2362 /a> span classwe're done parsing thesinput, undefL39aBUG macronand>dump onfig ss="commentlock. /span v129am va#undef3ef">old /a> = 1294m vaL313">23save /a>(&old /a> = 129am vaf">chunk /a>);v129am vaL396">23pu_chunk /a> *< clasnr_groupsode=pcpu_chunk" clasnr_groupsn_lo/ef25 /a> chunk /a>->chunk /a>);v1297m vaL313">23save /a>(&< clasgroup_offsetsode=pcpu_chunk" clasgroup_offsetsef">refpu_chunk /a> *ef">chunk /a>);v1298m vaL313">23su_chunk /a> *refpu_chunk /a> *ef">chunk /a>);v129am vaL399">2399 /a> ef">chunk /a>);v130#m vaL396">239ave /a>(& ef">chunk /a>);v130am vaf">chunk /a>);v130am vaL362">2362 /a> span classdek: mL37 bas"> parclak: sass="commentlock. /span v1303m vaL392">23ap /a>(struct < clasunit_ agesode=pcpu_chunk" clasunit_ agesn_lo/ef25 /a> chunk /a>->egw_apu_chunk /a> *ef">chunk /a>);v1304m vaL313">23save /a>(& < clasunit_ agesode=pcpu_chunk" clasunit_ agesn_lo/eew_eew_apu_chunk /a> *ef">chunk /a>);v130am vaL395">23pu_chunk /a> *< classtomf claode=pcpu_chunk" classtomf clan_lo/ef25 /a> chunk /a>->chunk /a>);v130am vaL396">23pu_chunk /a> *< clasa hre_ area_f claode=pcpu_chunk" clasa hre_ area_f clan_lo/efsclaof( area_map /a>(struct chunk /a>);v130am vaL337">2337 /////su_chunk /a> *(struct < clasunit_ agesode=pcpu_chunk" clasunit_ agesn_lo)a* sclaof(unsign="clong)ef">chunk /a>);v130am vaf">chunk /a>);v1309m vaL362">2362 /a> span clas="commentlock. /span v131sm vaL369">2369 /a> span claaaaaaaaa* Amem_zals clas slotsa The cddiataral 369t slot is for="commentlock. /span v131am vaL371">2371 /a> span claaaaaaaaa* empty classases pcpu_lock. /span v131am vaL372">2372 /a> span claaaaaaaaa*s="commentlock. /span v1313m vaL392">23ap /a>(struct < clasnr_slotsode=pcpu_chunk" clasnr_slots="lo/ef25 /a> <__pclasscla__o_slotode=pcpu_chunk"__pclasscla__o_slotn_locap /a>(struct < clasunit_ claef="+code=size"a hreunit_ clan_lo) + 2ef">chunk /a>);v13c4m vaL313">23save /a>(& = 0, < clasnr_slotsode=pcpu_chunk" clasnr_slots="lo/* sclaof(ef">old /a> = chunk /a>);v13cam vaL395">2372 /cef">old /a> = * *< clasnr_slotsode=pcpu_chunk" clasnr_slots="lo_apu_chunk /a> *chunk /a>);v131am vaL396">2396 /a> pu_chunk /a> *(& *chunk /a>);v131am vaf">chunk /a>);v1318m vaL313">23s2 /a> span clas="commentlock. /span v131am vaL369">2369 /a> span claaaaaaaaa* Initialclans382"> chlasa If reserved_ cla is zero, 132sm vaL369">2369 /a> span claaaaaaaaa* s382"> chlas cov: sas382"> crea +/dy clic _mem_zatar creaxtcomment">/** /span v132am vaL371">2371 /a> span claaaaaaaaa* in thesfirdt2 clasa If reserved_ cla is not zero, itefs pcpu_lock. /span v132am vaL372">2372 /a> span claaaaaaaaa* cov: sas382"> crea +/reservednarea (mostly used 72 /modulextcomment">/** /span v132am vaL263">2263 /a> span claaaaaaaaa* s382"> v132am vaL264">2264 /a> span claaaaaaaaa*s="commentlock. /span v132am vaL395">23pu_chunk /a> * = 0, < clasa hre_ area_f claode=pcpu_chunk" clasa hre_ area_f clan_lo)ef">chunk /a>);v132am vaL396">23pu_chunk /a> *(&chunk /a>->chunk /a>);v1327m vaL313">23save /a>(&chunk /a>-> chunk /a>);v1328m vaL313">23su_chunk /a> *chunk /a>-> chunk /a>);v132am vaL399">2399 /a> chunk /a>-> = 0, chunk /a>);v133#m vaL396">239ave /a>(&chunk /a>-> chunk /a>);v1331m vaL399">2399 /a> = 0, chunk /a>->old /a> = < clasunit_ agesode=pcpu_chunk" clasunit_ agesn_lo)ef">chunk /a>);v133am va258">2258 /a>}v1333m vaL392">23f2 /9ave /a>(&chunk /a>->nslot /a>) {v1334m vaL392">2398 /a> ef">old /a> = chunk /a>-> chunk /a>->chunk /a>);v133am vaL395">2369 /aaaaef">old /a> = < clasreserved_a href="+code=chunk"pclasreserved_a hren_lo/ef25 /a> chunk /a>);v133am vaL396">2396 /a> pu_chunk /a> * chunk /a>->_ claef="+code=size"a382">_ clas="sr+_size /a> = 0, chunk /a>->chunk /a>);v1337m vaL313">23} elseef">nslot /a>) {v133am vaL298">2298 /a> su_chunk /a> *chunk /a>-> chunk /a>);v133am vaL269">2269 /aaaaap /a>(struct 134#m vaL396">23L258">2258 /a>}v1341m vaL399">2399 /a> chunk /a>->< ontig_hintode=pcpu_chunk" ontig_hintn_lo/ef25 /a> chunk /a>->chunk /a>);v134am va258">2258 /a>}v1343m vaL392">23ap /a>(struct chunk /a>-> *chunk /a>-> chunk /a>->_ claef="+code=size"a382">_ clas="sef">chunk /a>);v1344m vaL313">23f2 /9ave /a>(&chunk /a>->chunk /a>);v134am vaL395">2369 /aaaaef">old /a> = chunk /a>-> *chunk /a>-> chunk /a>->chunk /a>);v134am vaL206">2206 /a>v1347m vaL313">23s2 /a> span classinitsdy clics clas if necessaryass="commentlock. /span v1348m vaL313">23f2 /9ave /a>(&nslot /a>) {v134am vaL269">2269 /aaaaap /a>(struct = 0, < clasa hre_ area_f claode=pcpu_chunk" clasa hre_ area_f clan_lo)ef">chunk /a>);v135#m vaL311">2333333333ef">old /a> = (&chunk /a>->chunk /a>);v135am vaL311">2333333333save /a>(&chunk /a>-> chunk /a>);v135am vaL392">2398 /a> save /a>(&chunk /a>-> chunk /a>);v1353m vaL392">2398 /a> ef">old /a> = chunk /a>-> = 0, chunk /a>);v1354m vaL392">2398 /a> ef">old /a> = chunk /a>-> chunk /a>);v135am vaL395">2369 /aaaaef">old /a> = = 0, chunk /a>->old /a> = < clasunit_ agesode=pcpu_chunk" clasunit_ agesn_lo)ef">chunk /a>);v135am vaL206">2206 /a>v135am vaL337">2337 /////su_chunk /a> *chunk /a>->< ontig_hintode=pcpu_chunk" ontig_hintn_lo/ef25 /a> chunk /a>-> chunk /a>);v135am vaL298">2298 /a> su_chunk /a> *chunk /a>-> *chunk /a>-> chunk /a>);v135am vaL269">2269 /aaaaap /a>(struct chunk /a>-> *chunk /a>-> chunk /a>->chunk /a>);v136#m vaL396">23L258">2258 /a>}v136am vaf">chunk /a>);v136am vaL362">2362 /a> span classaL3k thesfirdt2 clas in ss="commentlock. /span v1363m vaL392">23ap /a>(struct < clasfirdt_a href="+code=chunk"pclasfirdt_a hren_lo/ef25 /a> chunk /a>);v1364m vaL313">23save /a>(& = 0, < clasfirdt_a href="+code=chunk"pclasfirdt_a hren_lo, -1)ef">chunk /a>);v136am vaf">chunk /a>);v136am vaL396">2362 /a> span classwe're done ss="commentlock. /span v1367m vaL313">23save /a>(&< clasbase_sddrode=pcpu_chunk" clasbase_sddrs="saef25 /a> chunk /a>);v136am vaL298">22return 0ef">chunk /a>);v136am vaL258">2258 /a>}v137#m vaL397">2397 /a>v137am va#ifdef3pu_chunk /a> *chunk /a>);v137am va258">2258 /a>}v1373m va ons_mcharpcef">old /a> = * <__initdataode=pcpu_chunk"__initdatas="saeff">nslot /a>) {v1374m vaL313">23[pu_chunk /a> *2369 /a_aring">"auto"="commer">nslot /a>) {v137am vaL395">23[pu_chunk /a> *2369 /a_aring">"embed"="commer">nslot /a>) {v137am vaL396">23[pu_chunk /a> *2369 /a_aring">" age"="commer">nslot /a>) {v137am va}ef">chunk /a>);v137am vaf">chunk /a>);v137am vaenum3ap /a>(struct < clasfsode=pcpu_chunk" clasfsm vaLsave /a>(&(&<__initdataode=pcpu_chunk"__initdatas="saefpu_chunk /a> *chunk /a>);v138#m vaL397">2397 /a>v138am vas382"> intLsave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(&old /a> = <_aref="+code=size"a3rn_lorf">chunk /a>);v138am vaf">nslot /a>) {v1383m vaL392">23f2 /0rf">chunk /a>);v1384m vaL392">2398 /a> 62 /a> span classnada ss="commeef">chunk /a>);v138am va#ifdef3pu_chunk /a> *2397 /a>v138am vaL396">23elseef2 /a> if (! = 0, <_aref="+code=size"a3rn_lo,f2369">2369 /a_aring">"embed"="comme)rf">chunk /a>);v138am vaL337">2337 /////su_chunk /a> * *chunk /a>);v13cam va#endiff">chunk /a>);v138am va#ifdef3pu_chunk /a> *2397 /a>v139#m vaL311">23elseef2 /a> if (! = 0, <_aref="+code=size"a3rn_lo,f2369">2369 /a_aring">" age"="comme)rf">chunk /a>);v139am vaL311">2333333333save /a>(& *chunk /a>);v139am va#endiff">chunk /a>);v1393m vaL311">23elsef">chunk /a>);v1394m vaL392">2398 /a> ef">old /a> = 2369 /a_aring">"PERCPU: unknown _mem_zaor %s specified\n"="commerf25 /a> chunk /a>);v139am vaf">chunk /a>);v139am vaL396">23return 0ef">chunk /a>);v1397m vaL258">2258 /a>}v1398m va25 /a> 2369 /a_aring">"av chunk /a>);v139am vaL259">2259 /a>v140sm vaL369">2369 /a> span clas="commentlock. /span v140am vaL371">2371 /a> span cla* clasembedsfirdt_a hre() is used by thesgener"> v140am vaL372">2372 /a> span cla* Build it if needed by thesarch onfig or thesgener"> setup is goingn_s pcpu_lock. /span v140am vaL263">2263 /a> span cla* to be usedases pcpu_lock. /span v140am vaL264">2264 /a> span class="commentlock. /span v140am va#iff25 /a> = 0, 140am vaL396">23a> if (! = 0, chunk /a>);v140am va#defL39aeize /a> = 0, 2259 /a>v140am va#endiff">chunk /a>);v140am vaL259">2259 /a>v141sm vaL369">2369 /a> span classbuild clas agesfirdt_a hre() iff needed by thesarch onfig ss="commentlock. /span v1411m va#iff25 /a> = 0, chunk /a>);v141am va#defL39aeize /a> = 0, 2259 /a>v1413m va#endiff">chunk /a>);v1414m vaf">chunk /a>);v14cam vas2 /a> span classpclasbuildr"s="sfinfo() is used by both embednand> agesfirdt2 clas ss="commentlock. /span v141am va#iff25 /a> = 0, = 0, chunk /a>);v141am vas2 /a> span class="commentlock. /span v1418m vaL371">2371 /a> span cla* clasbuildr"s="sfinfo -sbuild "s="sfinfo onsidering distances between CPUs="commentlock. /span v141am vaL369">2369 /a> span cla* @reserved_ cla: thes cla of reserved v142sm vaL369">2369 /a> span cla* @dyn_ cla: minimum frees cla 72 /dy clic _mem_zatar in bytes="commentlock. /span v142am vaL371">2371 /a> span cla* @stomf cla: _mem_zatar ctom clan_commentlock. /span v142am vaL372">2372 /a> span cla* @clasdistance_fn: c_meback to dek: mL37 distance between clas, opataraln_commentlock. /span v142am vaL263">2263 /a> span clas="commentlock. /span v142am vaL264">2264 /a> span cla* This funcatar dek: mL37s grouping of units, 142am vas2 /a> span cla* and>other parclak: sa onsidering needed v142am vas2 /a> span cla* atom clanand>distances between CPUsases pcpu_lock. /span v142am vas2 /a> span clas="commentlock. /span v1428m vaL371">2371 /a> span cla* Groups _re _mways mutliples of atom clanand>CPUs which _re of="commentlock. /span v142am vaL369">2369 /a> span cla* LOCAL_DISTANCE both ways _re grouped together and>sh_re 369ce for="commentlock. /span v143sm vaL369">2369 /a> span cla* units in thesscla groupa The returned onfigurzatar is guarcnte9dn_commentlock. /span v143am vaL371">2371 /a> span cla* to have>CPUs ar differan n0, s ar differan groups _nd>ef">=75% usagen_commentlock. /span v143am vaL372">2372 /a> span cla* of amem_zald virtual cddress 369ceases pcpu_lock. /span v143am vaL263">2263 /a> span clas="commentlock. /span v143am vaL264">2264 /a> span cla* RETURNS:="commentlock. /span v143am vas2 /a> span cla* On success, pointer to thesnew _mem_zatarfinfo is returneda Or="commentlock. /span v143am vas2 /a> span cla* failura, ERR_PTR value is returneda="commentlock. /span v143am vas2 /a> span class="commentlock. /span v143am vas382"> area_map /a>(struct (&143am vaL269">2269 /aaaaL392">2398 /a> ef">old /a> = (&(&nslot /a>) {v144#m vaL311">2333333333L392">2398 /a> ef">old /a> = (&nslot /a>) {v144am vaL311">23333333333333333333333333save /a>(&< clasfc_clasdistance_fn__ef="+code=size" clasfc_clasdistance_fn__m vaLsave /a>(&chunk /a>);v144am vaf">nslot /a>) {v1443m vaL392">23s382"> intLsave /a>(& * <__initdataode=pcpu_chunk"__initdatas="sef">chunk /a>);v1444m vaL313">23s382"> intLsave /a>(& * <__initdataode=pcpu_chunk"__initdatas="sef">chunk /a>);v144am vaL395">23 ons_mef">old /a> = (&_ claef="+code=size"a382">_ clas="sref25 /a> <__per_clasendode=pcpu_chunk"__per_clasends="sr-f25 /a> <__per_clasa38rtode=pcpu_chunk"__per_clasa38rts="sef">chunk /a>);v144am vaL396">23intLsave /a>(& chunk /a>);v1447m vaL313">23save /a>(&(& chunk /a>);v1448m vaL313">23fntLsave /a>(& = 0, span classunits_per_ss="sass="commentlock. /span v144am vaL269">22fntLsave /a>(&<9" t_ss="ssode=pcpu_chunk"9" t_ss="sss="srf25 /a> ef">chunk /a>);v145#m vaL311">23unsign="cfntLsave /a>(&rf25 /a> ef">chunk /a>);v145am vaL311">23 area_map /a>(struct chunk /a>);v145am vaL392">23unsign="cfntL*25 /a> chunk /a>);v1453m vaf">chunk /a>);v1454m vaL392">2362 /a> span classthis funcatar may be c_me="cmultiple timesass="commentlock. /span v145am vaL395">2325 /a> = 0, old /a> = chunk /a>);v145am vaL396">23pu_chunk /a> * = 0, old /a> = chunk /a>);v145am vaf">chunk /a>);v1458m vaL313">23s2 /a> span clas c_mculzal acla_sul _nd>ensure dyn_ cla is enough 72 /early ss="sass="commentlock. /span v145am vaL399">2399 /a> * = 0, _ claef="+code=size"a382">_ clas="sr+_size /a> = 0, chunk /a>);v146#m vaL311">2333333333L392">2398 /25 /a> = 0, chunk /a>);v1461m vaL399">2399 /a> _ claef="+code=size"a382">_ clas="sr-f25 /a> chunk /a>);v146am va258">2258 /a>}v1463m vaL392">23a369">2369 /a> span clas="commentlock. /span v146am vaL264">2264 /a> span claaaaaaaaa* Dek: mL37 minsunit_ cla, _mem__ clanand>max_upa suchsthatefs pcpu_lock. /span v146am vas2 /a> span claaaaaaaaa* _mem__ claniscmultiple of atom_ clanand>iscthessm_me=stefs pcpu_lock. /span v146am vas2 /a> span claaaaaaaaa* which c/a>ac spodzal 4k _mign="csegpan s which _re equal toefs pcpu_lock. /span v146am vas2 /a> span claaaaaaaaa* 2 /larger th/a>minsunit_ claa="commentlock. /span v1468m vaL371">2371 /a> span claaaaaaaaa*s="commentlock. /span v146am vaL399">2399 /a> = 0, 147#m vaL397">2397 /a>v1471m vaL399">2399 /a> <"s="sfsclaode=pcpu_chunk"ss="sfsclas="sref99 /a> = 0, 1472m vaL399">2399 /a> 1473m vaL392">23while /9ave /a>(& (& 1474m vaL313">23L399">2399 /a> 147am vaL395">2325 /a> 147am vaL206">2206 /a>v1477m vaL313">23s2 /a> span classgroup clas>ac rding to their proximityass="commentlock. /span v1478m vaL313">23su_chunk /a> *<72 _each_possible_c hode=pcpu_chunk"72 _each_possible_c hn_loceize /a> = 0, ref">nslot /a>) {v147am vaL269">2269 /aaaaap /a>(struct chunk /a>);v148#m vaL396">239ave /a>(&chunk /a>);v148am vaL311">2333333333save /a>(&<72 _each_possible_c hode=pcpu_chunk"72 _each_possible_c hn_loceize /a> = 0, ref">nslot /a>) {v148am vaL392">2398 /a> f2 /9ave /a>(& =ef25 /a> r">nslot /a>) {v1483m vaL392">2398 /a> breakef">chunk /a>);v1484m vaL392">2398 /a> f2 /9ave /a>(& *] =ef25 /a> (&chunk /a>);v148am vaL395">2369 /aaaaaaaaaaaaaaaa/9ave /a>(&(&rf25 /a> )>ef">f25 /a> chunk /a>);v148am vaL396">2396 /a> 1">2333333333save /a>(&(&rf25 /a> reef">f25 /a> nslot /a>) {v148am vaL337">2337 /////> 1">2333333333save /a>(&chunk /a>);v148am vaL298">2298 /a> > 1">2333333333save /a>(& (& chunk /a>);v148am vaL269">2269 /aaaaL392">2398 /a> goto 9ave /a>(&chunk /a>);v149#m vaL311">2333333333L392">23L258">2258 /a>}v149am vaL311">2333333333L258">2258 /a>}v149am vaL392">2398 /a> save /a>(& *]ref25 /a> chunk /a>);v1493m vaL392">2398 /a> ef">old /a> = *chunk /a>);v1494m vaL392">23L258">2258 /a>}v149am vaf">chunk /a>);v149am vaL396">2362 /a> span clas="commentlock. /span v149am vas2 /a> span claaaaaaaaa* Expand>unit clanuntil cddress 369ce usage go s aver 75%="commentlock. /span v1498m vaL371">2371 /a> span claaaaaaaaa*nand>then ascmuch _s possible without using more _ddress="commentlock. /span v149am vaL369">2369 /a> span claaaaaaaaa*n369ceases pcpu_lock. /span v150sm vaL369">2369 /a> span claaaaaaaaa*s="commentlock. /span v1501m vaL399">2399 /a> chunk /a>);v150am vaL392">2372 //9ave /a>(& nslot /a>) {v1503m vaL392">2398 /a> fntLsave /a>(& chunk /a>);v1504m vaf">chunk /a>);v150am vaL395">2369 /aaaaf2 /9ave /a>(& (& );v150am vaL396">2396 /a> 1">23333 ontinueef">chunk /a>);v150am vaf">chunk /a>);v150am vaL298">2298 /a> 72 //9ave /a>(& f25 /a> nslot /a>) {v150am vaL269">2269 /aaaaL392">23fntLsave /a>(& (& * chunk /a>);v151#m vaL311">2333333333L392">23save /a>(& chunk /a>);v151am vaL311">23333333333333333325 /a> *chunk /a>);v151am vaL392">2398 /a> L258">2258 /a>}v1513m vaf">chunk /a>);v1514m vaL392">2398 /a> 62 /a> span clas="commentlock. /span v15cam vas2 /a> span cl33333333333333333* Don't>ac ept if w" tage is aver 1/3a The="commentlock. /span v151am vas2 /a> span claaaaaaaaa33333333* greater-th/a> sparison>ensures upa==1 _mways="commentlock. /span v151am vas2 /a> span claaaaaaaaa33333333* p escthesfos="wing checkases pcpu_lock. /span v1518m vaL371">2371 /a> span claaaaaaaaa33333333*s="commentlock. /span v151am vaL269">2269 /aaaaf2 /9ave /a>(&f25 /a> );v152#m vaL311">2333333333L392">23 ontinueef">chunk /a>);v152am vaf">chunk /a>);v152am vaL392">2398 /a> s2 /a> span classand>then don't> onsume more memoryass="commentlock. /span v1523m vaL392">2398 /a> f2 /9ave /a>(&f25 /a> );v1524m vaL392">2398 /a> breakef">chunk /a>);v152am vaL395">2369 /aaaaef">old /a> = chunk /a>);v152am vaL396">2396 /a> 25 /a> 152am vaL337">23L258">2258 /a>}v1528m vaL313">23su_chunk /a> * 152am vaL259">2259 /a>v153#m vaL396">2392 /a> span classamem_zalsand>fill "s="sfinfo ss="commentlock. /span v153am vaL311">2372 //9ave /a>(& f25 /a> 153am vaL392">2398 /a> save /a>(& = 0, * chunk /a>);v1533m vaf">chunk /a>);v1534m vaL313">23save /a>(&<"iode=pcpu_chunk"silist/ef25 /a> < clas"s="sf"s="sfinfoode=pcpu_chunk" clas"s="sf"s="sfinfon_loc9ave /a>(& chunk /a>);v153am vaL395">23f2 /a> if (!<"iode=pcpu_chunk"silistrntlock. /span v153am vaL396">2396 /a> return > if (! chunk /a>);v1537m vaL313">23save /a>(& chunk /a>->(&chunk /a>);v153am vaf">chunk /a>);v153am vaL269">2272 //9ave /a>(& f25 /a> nslot /a>) {v154#m vaL311">233333333325 /a> chunk /a>-> *(& chunk /a>);v154am vaL311">2333333333save /a>(& = 0, * chunk /a>);v154am vaL392">23L258">2258 /a>}v1543m vaf">chunk /a>);v1544m vaL313">23save /a>(&<"iode=pcpu_chunk"silistref">chunk /a>->_ claef="+code=size"a382">_ clas="sref25 /a> _ claef="+code=size"a382">_ clas="sef">chunk /a>);v154am vaL395">2325 /a> <"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>);v154am vaL396">23pu_chunk /a> *<"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>);v1547m vaL313">23save /a>(&<"iode=pcpu_chunk"silistref">chunk /a>-> chunk /a>);v1548m vaL313">23su_chunk /a> *<"iode=pcpu_chunk"silistref">chunk /a>-><"tomf claode=pcpu_chunk"stomf clan_loref99 /a> chunk /a>);v154am vaL399">2399 /a> <"iode=pcpu_chunk"silistref">chunk /a>-><"s="sfsclaode=pcpu_chunk"ss="sfsclas="sref99 /a> <"s="sfsclaode=pcpu_chunk"ss="sfsclas="sef">chunk /a>);v155#m vaL397">2397 /a>v155am vaL311">2372 //9ave /a>(& /ef0ef25 /a> * nslot /a>) {v155am vaL392">2398 /a> area_map /a>(struct chunk /a>-> *chunk /a>);v1553m vaf">chunk /a>);v1554m vaL392">2398 /a> 62 /a> span clas="commentlock. /span v155am vas2 /a> span cl33333333333333333* Initialcla base_offset _s if ame groups _re em_zald="commentlock. /span v155am vas2 /a> span claaaaaaaaa33333333* back-to-backa The c_me=r should updzal this toefs pcpu_lock. /span v155am vas2 /a> span claaaaaaaaa33333333* k. lect>actual cmem_zatarases pcpu_lock. /span v1558m vaL371">2371 /a> span claaaaaaaaa33333333*s="commentlock. /span v155am vaL269">2269 /aaaaap /a>(struct chunk /a>-> /*f25 /a> <"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>);v156#m vaL397">2397 /a>v156am vaL311">2333333333save /a>(&<72 _each_possible_c hode=pcpu_chunk"72 _each_possible_c hn_loceize /a> = 0, rL397">2397 /a>v156am vaL392">2398 /a> f2 /9ave /a>(& *]reef25 /a> 2397 /a>v1563m vaL392">2398 /a> ap /a>(struct chunk /a>-> *chunk /a>-> ef">chunk /a>);v1564m vaL313">23L399">2399 /a> chunk /a>-> = 0, chunk /a>-> chunk /a>);v156am vaL395">2369 /aaaaef">old /a> = /+ef25 /a> chunk /a>->chunk /a>);v156am vaL396">23L258">2258 /a>}v1567m vaL313">23save /a>(& = 0, /!ef25 /a> chunk /a>);v156am vaf">chunk /a>);v156am vaL399">23return > if (!<"iode=pcpu_chunk"silistef">chunk /a>);v157#m vaL258">2258 /a>}v1571m va#endif392 /a> span classBUILD_EMBED_FIRST_CHUNK/|| BUILD_PAGE_FIRST_CHUNK3*s="commentlock. /span v157am va258">2258 /a>}v1573m va#iff25 /a> = 0, 2258 /a>}v157am vaL264">2264 /a> span class="commentlock. /span v157am vas2 /a> span cla* clasembedsfirdt_a hre - embednthesfirdt2 v157am vas2 /a> span cla* @reserved_ cla: thes cla of reserved v157am vas2 /a> span clas @dyn_ cla: minimum frees cla 72 /dy clic _mem_zatar in bytes="commentlock. /span v1578m vaL371">2371 /a> span cla* @stomf cla: _mem_zatar ctom clan_commentlock. /span v157am vaL369">2369 /a> span cla* @clasdistance_fn: c_meback to dek: mL37 distance between clas, opataraln_commentlock. /span v158sm vaL369">2369 /a> span cla* @ss="sffn: funcatar to amem_zals v158am vaL371">2371 /a> span cla* @freeffn: funcatar to frees v158am vaL372">2372 /a> span cla*n_commentlock. /span v158am vaL263">2263 /a> span clas This is locelper to eases etting up embedded firdt2 v158am vaL264">2264 /a> span cla* c/a>be c_me="cwhere clas etup_firdt_a hre() is expecteda="commentlock. /span v158am vas2 /a> span cla*="commentlock. /span v158am vas2 /a> span cla* Ifsthis funcatar is used to etupnthesfirdt2a hre, it is llem_zald="commentlock. /span v158am vas2 /a> span clas by c_meing @ss="sffnsand>used as-is without being mapp="cfntoefs pcpu_lock. /span v1588m vaL371">2371 /a> span cla* vmss="sa_rea. Amem_zatars _re _mways wholecmultiples of @stomf clan_s pcpu_lock. /span v158am vaL369">2369 /a> span cla* _mign="cto @stomf claa="commentlock. /span v159sm vaL369">2369 /a> span cla*="commentlock. /span v159am vaL371">2371 /a> span cla* This enablescthesfirdt2 clas to piggy back ar thesaL39ar physicaln_commentlock. /span v159am vaL372">2372 /a> span cla* mapping which often u esclarger ages claa Pleasesnoal thatsthisn_commentlock. /span v159am vaL263">2263 /a> span clas c/a>result in veryn369rsesa href">unit mapping ar NUMA machinescthas="commentlock. /span v159am vaL264">2264 /a> span cla* requiring large vmss="sa_ddress 369cea Don't>u esthis llem_za2 /if="commentlock. /span v159am vas2 /a> span cla* vmss="sa369ce is noa ord: saof magnitude/larger th/a>distances="commentlock. /span v159am vas2 /a> span cla* between n0, memorya_ddressesc(iea 32bit NUMA machines)a="commentlock. /span v159am vas2 /a> span cla*="commentlock. /span v1598m vaL371">2371 /a> span clas @dyn_ claa36ecifiescthesminimum dy clic _rea claa="commentlock. /span v159am vaL369">2369 /a> span cla*="commentlock. /span v160sm vaL369">2369 /a> span cla* Ifsthe needed claniscsm_me=r th/a>thesminimum 2 /36ecified>unit="commentlock. /span v160am vaL371">2371 /a> span cla* cla, thesaeftaver is returned using @freeffna="commentlock. /span v160am vaL372">2372 /a> span cla*n_commentlock. /span v160am vaL263">2263 /a> span clas RETURNS:="commentlock. /span v160am vaL264">2264 /a> span cla* 0 ar success, -errno ar failuraa="commentlock. /span v160am vas2 /a> span cla*s="commentlock. /span v160am vafntLsave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(& = 0, (&(&nslot /a>) {v160am vaL337">2337 /////> 1">2333333333 ef">old /a> = (&nslot /a>) {v160am vaL298">2298 /a> > 1">2333333333 ef">old /a> = < clasfc_clasdistance_fn__ef="+code=size" clasfc_clasdistance_fn__m vaLsave /a>(&nslot /a>) {v160am vaL269">2269 /aaaaL392">2333333333 ef">old /a> = < clasfc_ss="sffn__ef="+code=size" clasfc_ss="sffn__m vaLsave /a>(&nslot /a>) {v161#m vaL311">2333333333L392">2333333333 ef">old /a> = < clasfc_freeffn__ef="+code=size" clasfc_freeffn__m vaLsave /a>(&2258 /a>}v161am vaf">nslot /a>) {v161am vaL392">23voida*25 /a> chunk /a>);v1613m vaL392">23voida**25 /a> <_reasode=pcpu_chunk"sreasn_loref99 /a> chunk /a>);v1614m vaL392">23 area_map /a>(struct chunk /a>);v161am vaL395">2325 /a> (& chunk /a>);v161am vaL396">23intLsave /a>(& chunk /a>);v161am vaf">chunk /a>);v1618m vaL313">23su_chunk /a> *<"iode=pcpu_chunk"silist/ef25 /a> < clasbuilde"s="sfinfoode=pcpu_chunk" clasbuilde"s="sfinfon_loceize /a> = 0, nslot /a>) {v161am vaL269">2269 /aaaa3L392">2333333333 ef">old /a> = chunk /a>);v162#m vaL311">23f2 /9ave /a>(& = 0, <"iode=pcpu_chunk"silistr)258">2258 /a>}v162am vaL311">2333333333return > if (! = 0, <"iode=pcpu_chunk"silistref">chunk /a>);v162am va258">2258 /a>}v1623m vaL392">23save /a>(& chunk /a>->_ claef="+code=size"a382">_ clas="sr+_size /a> = 0, <"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>->chunk /a>);v1624m vaL313">23save /a>(&<"reasf claode=pcpu_chunk"sreasf clas="sLefpu_chunk /a> * = 0, <"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>);v162am vaf">chunk /a>);v162am vaL396">23pu_chunk /a> *<"reasode=pcpu_chunk"sreasn_loref99 /a> <"s="sfbootmem_nopanicef="+code=size""s="sfbootmem_nopanicn_loceize /a> = 0, <"reasf claode=pcpu_chunk"sreasf clas="sref">chunk /a>);v162am vaL337">23f2 /a> if (!<"reasode=pcpu_chunk"sreasn_loref">nslot /a>) {v162am vaL298">2298 /a> 25 /a> chunk /a>);v162am vaL269">2269 /aaaagoto 9ave /a>(&chunk /a>);v163#m vaL396">23L258">2258 /a>}v163am vaf">chunk /a>);v163am vaL392">2392 /a> span classamem_zal, copysand>dek: mL37 basea_ddress *s="commentlock. /span v1633m vaL392">2372 //9ave /a>(& f25 /a> <"iode=pcpu_chunk"silistref">chunk /a>-> nslot /a>) {v1634m vaL313">23L399">23 area_map /a>(struct chunk /a>-> *slot /a>) {v163am vaL395">2369 /aaaaunsign="cintLsave /a>(&ref99 /a> chunk /a>);v163am vaL396">2396 /a> voida*25 /a> chunk /a>);v163am vaf">chunk /a>);v163am vaL298">2298 /a> 72 //9ave /a>(& f25 /a> chunk /a>->(&reef99 /a> 163am vaL269">2269 /aaaa3L392">2save /a>(&ref99 /a> chunk /a>-> *slot /a>) {v164#m vaL311">233333333325 /a> = 0, reef99 /a> chunk /a>);v164am vaf">chunk /a>);v164am vaL392">2398 /a> s2 /a> span classamem_zals369ce 72 /theswholecgroup *s="commentlock. /span v1643m vaL392">2398 /a> ef">old /a> = <"s="sffnode=pcpu_chunk"ss="sffnm va/9ave /a>(&rf25 /a> chunk /a>-> <"iode=pcpu_chunk"silistref">chunk /a>->1644m vaL313">23L399">23f2 /a> if (!nslot /a>) {v164am vaL395">2369 /aaaa98 /a> ef">old /a> = chunk /a>);v164am vaL396">2396 /a> 1">23333goto 9ave /a>(&chunk /a>);v164am vaL337">2337 /////L258">2258 /a>}v164am vaL298">2298 /a> 22 /a> span classkmemleak trackscthes v164am vaL269">2269 /aaaa9ave /a>(&(&chunk /a>);v165#m vaL311">233333333325 /a> * < trode=pcpu_chunk" trn_loef">chunk /a>);v165am vaf">chunk /a>);v165am vaL392">2398 /a> 25 /a> (& chunk /a>);v1653m vaL392">23L258">2258 /a>}v1654m vaf">chunk /a>);v165am vaL395">2322 /a> span clas="commentlock. /span v165am vas2 /a> span claaaaaaaaa* Copysdatasand>freesunused partsa Thiscshould happ=n after _me="commentlock. /span v165am vas2 /a> span claaaaaaaaa* _mem_zatars _re splete; otherwise, we may end>up with="commentlock. /span v1658m vaL371">2371 /a> span claaaaaaaaa* averlapping groupsa="commentlock. /span v165am vaL369">2369 /a> span claaaaaaaaa*s="commentlock. /span v166#m vaL311">2372 //9ave /a>(& f25 /a> <"iode=pcpu_chunk"silistref">chunk /a>-> nslot /span v166am vaL311">2333333333 area_map /a>(struct chunk /a>-> *slot /span v166am vaL392">2398 /a> voida*25 /a> <"reasode=pcpu_chunk"sreasn_lo[pu_chunk /a> *slot /span v1663m vaf">chunk /a>);v1664m vaL313">23L399">2372 //9ave /a>(& f25 /a> chunk /a>-> <"iode=pcpu_chunk"silistref">chunk /a>->nslot /span v166am vaL395">2369 /aaaaaaaaaaaaf2 /9ave /a>(&chunk /a>-> * nslot /span v166am vaL396">2396 /a> 1">23333L395">2322 /a> span classunused unit,>freeswholec*s="commentlock. /span v166am vaL337">2337 /////> 1">233333333399 /a> (& <"iode=pcpu_chunk"silistref">chunk /a>->slot /span v166am vaL298">2298 /a> > 1">2333333333 ontinueef">chunk /a>);v166am vaL269">2269 /aaaa3L392">2L258">2258 /a>}v167#m vaL311">2333333333L392">23s2 /a> span classcopysand>return thesunused partc*s="commentlock. /span v167am vaL311">23333333333333333325 /a> (& <__ v<_clasloadode=pcpu_chunk"__ v<_clasloadn_lorf25 /a> <"iode=pcpu_chunk"silistref">chunk /a>->_ claef="+code=size"a382">_ clas="sref">slot /span v167am vaL392">2398 /a> 99 /a> (& = 0, chunk /a>->slot /span v1673m vaL392">2398 /a> L258">2258 /a>}v1674m vaL313">23L258">2258 /a>}v167am vaf">chunk /a>);v167am vaL396">23p2 /a> span classbasea_ddress is now known,>dek: mL37 group baseaoffsets *s="commentlock. /span v1677m vaL313">23save /a>(&chunk /a>);v167am vaL298">2272 //9ave /a>(& f25 /a> <"iode=pcpu_chunk"silistref">chunk /a>-> nslotk /a>);v167am vaL269">2269 /aaaa9ave /a>(&chunk /a>-> *(& * chunk /a>);v168#m vaL311">233333333325 /a> (& nslot /a>) {v168am vaL311">2333333333333333339">2269 /aaaa9ave /a>(&chunk /a>-> *(&slot /span v168am vaL392">23L258">2258 /a>}v1683m vaL392">23save /a>(& <"iode=pcpu_chunk"silistref">chunk /a>->slot /span v1684m vaf">chunk /a>);v168am vaL395">2322 /a> span clas warn if maximum distance is further th/a>75%aof vmss="sa369ce *s="commentlock. /span v168am vaL396">23i2 /9ave /a>(&f/9ave /a>(& nslotk /a>);v168am vaL337">2337 /////9ave /a>(& string">"PERCPU: max_distance=0x%zx too large 72 /vmss="sa"="commentlock. /span v168am vaL298">2298 /a> > 1">2333392 /a> string">"369ce 0x%lx\n"="commerf25 /a> nslot /a>) {v168am vaL269">2269 /aaaa3L392">2333(unsign="clong)/9ave /a>(& slot /span v169sm va#ifdeff25 /a> chunk /a>);v169am vaL311">2333333333s2 /a> span classand>fail3i2 we have 7_meback *s="commentlock. /span v169am vaL392">2398 /a> 25 /a> slot /span v1693m vaL392">2398 /a> goto 9ave /a>(&chunk /a>);v169am va#endiff">chunk /a>);v1695m vaL392">23L258">2258 /a>}v169am va258">2258 /a>}v1697m vaL313">23save /a>(&< r_infoode=pcpu_chunk" rfinfon_loce2 /a> string">"PERCPU: Embedded %zh pages/a h @%p s%zh r%zh d%zh u%zh\n"="commer258">2258 /a>}v169am vaL298">2298 /a> 25 /a> (& <"iode=pcpu_chunk"silistref">chunk /a>->_ claef="+code=size"a382">_ clas="srf25 /a> <"iode=pcpu_chunk"silistref">chunk /a>->2258 /a>}v169am vaL269">2269 /aaaa9ave /a>(&chunk /a>->chunk /a>->slot /span v170#m vaL397">2397 /a>v1701m vaL313">23save /a>(&(struct (& chunk /a>);v170am vaL392">23goto 9ave /a>(&chunk /a>);v1703m vaf">chunk /a>);v170am vaLave /a>(&chunk /a>);v1705m vaL392">2372 //9ave /a>(& f25 /a> <"iode=pcpu_chunk"silistref">chunk /a>-> chunk /a>);v170am vaL396">2396 /a> 99 /a> (& *2258 /a>}v170am vaL337">2337 /////> 1">239ave /a>(&chunk /a>-> *(& <"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>);v170am va9ave /a>(&chunk /a>);v170am vaL269">22ap /a>(struct chunk /a>);v171#m vaL311">23f2 /9ave /a>(&<"reasode=pcpu_chunk"sreasn_lorf">chunk /a>);v171am vaL311">2333333333save /a>(&<7ree_bootmemode=pcpu_chunk"7reefbootmem="va/9ave /a>(&<__paode=pcpu_chunk"__pam va/9ave /a>(& <"reasf claode=pcpu_chunk"sreasf clas="sref">chunk /a>);v171am vaL392">23return > if (!chunk /a>);v1713m vaL258">2258 /a>}v171am va#endif392 /a> span classBUILD_EMBED_FIRST_CHUNK/*s="commentlock. /span v171am vaf">chunk /a>);v171am va#ifdeff25 /a> chunk /a>);v171am vas2 /a> span class="commentlock. /span v1718m vaL371">2371 /a> span clas claspagesfirdt_a hre - mapnthesfirdt2a hre using PAGE_SIZE pages="commentlock. /span v171am vaL369">2369 /a> span cla* @reserved_ cla: thes cla of reserved v172sm vaL369">2369 /a> span cla* @ss="sffn: funcatar to amem_zals v172am vaL371">2371 /a> span cla* @freeffn: funcatar to frees v172am vaL372">2372 /a> span cla* @populzal_pteffn: funcatar to populzal pte="commentlock. /span v172am vaL263">2263 /a> span clas="commentlock. /span v172am vaL264">2264 /a> span cla* This is locelper to eases etting up page-remapp="cfirdt2 v172am vas2 /a> span cla* clas and c/a>be c_me="cwhere clas etup_firdt_a hre() is expecteda="commentlock. /span v172am vas2 /a> span cla*="commentlock. /span v172am vas2 /a> span clas This is thesbasic _mem_zaor. S382"> v1728m vaL371">2371 /a> span clas age-by- agesinto vmss="sa_rea.="commentlock. /span v172am vaL369">2369 /a> span cla*="commentlock. /span v173sm vaL369">2369 /a> span cla* RETURNS:="commentlock. /span v173am vaL371">2371 /a> span cla* 0 ar success, -errno ar failuraa="commentlock. /span v173am vaL372">2372 /a> span cla*s="commentlock. /span v1733m vafntLsave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(&(&(&1734m vaL313">23L399">23337 /////> 1">239ave /a>(&< clasfc_ss="sffn__ef="+code=size" clasfc_ss="sffn__m vaLsave /a>(&nslot /a>) {v173am vaL395">2369 /aaaa337 /////> 1">239ave /a>(&< clasfc_freeffn__ef="+code=size" clasfc_freeffn__m vaLsave /a>(&nslot /a>) {v173am vaL396">2396 /a> 337 /////> 1">239ave /a>(&< clasfc_populzal_pteffn__ef="+code=size" clasfc_populzal_pteffn__m vaLsave /a>(&chunk /a>);v173am vaf">nslotk /a>);v173am vaL298">22a382">3 area_map /a>(struct (&chunk /a>);v173am vaL269">22 area_map /a>(struct chunk /a>);v174#m vaL311">23charmap /a>(struct slot /span v174am vaL311">23fntLsave /a>(&chunk /a>);v174am vaL392">239ave /a>(&(&chunk /a>);v1743m vaL392">23 area_map /a>(struct chunk /a>);v1744m vaL313">23fntLsave /a>(& chunk /a>);v174am vaf">chunk /a>);v174am vaL396">23pu_chunk /a> *(&"%luK"="commerf25 /a> ef">f10ref">chunk /a>);v174am vaf">chunk /a>);v1748m vaL313">23su_chunk /a> *<"iode=pcpu_chunk"silist/ef25 /a> < clasbuilde"s="sfinfoode=pcpu_chunk" clasbuilde"s="sfinfon_loceize /a> = 0, chunk /a>);v174am vaL269">22f2 /9ave /a>(& = 0, <"iode=pcpu_chunk"silistr)258">2258 /a>}v175#m vaL311">2333333333return > if (! = 0, <"iode=pcpu_chunk"silistref">chunk /a>);v1751m vaL313">23save /a>(& = 0, <"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>);v175am vaL392">239ave /a>(& = 0, <"iode=pcpu_chunk"silistref">chunk /a>->(& slot /span v1753m vaf">chunk /a>);v1754m vaL313">23save /a>(& chunk /a>->ef">f25 /a> chunk /a>);v175am vaf">chunk /a>);v175am vaL396">23p2 /a> span classun_mign="c_mem_zatars can't>be freed, round>up to pages claa*s="commentlock. /span v1757m vaL313">23save /a>(&< ages_ claef="+code=size"pages_ cla="stLefpu_chunk /a> * = 0, 175am vaL298">2298 /a> > 1">233333333sclaof(9ave /a>(&slot /span v175am vaL269">22ap /a>(struct <"s="sfbootmemode=pcpu_chunk"ss="sfbootmem="va/9ave /a>(&< ages_ claef="+code=size"pages_ cla="stref">slot /span v176#m vaL397">2397 /a>v176am vaL311">23s2 /a> span classamem_zalspagesa*s="commentlock. /span v176am vaL392">239ave /a>(&chunk /a>);v1763m vaL392">2372 //9ave /a>(& f25 /a> chunk /a>);v1764m vaL313">23L399">2372 //9ave /a>(& f25 /a> nslotk /a>);v176am vaL395">2369 /aaaaaaaaaaaaunsign="cintLsave /a>(&ref99 /a> <"iode=pcpu_chunk"silistref">chunk /a>->(& *slot /span v176am vaL396">2396 /a> 1">23333voida*25 /a> chunk /a>);v176am vaf">chunk /a>);v176am vaL298">2298 /a> > 1">2325 /a> <"s="sffnode=pcpu_chunk"ss="sffnm va/9ave /a>(&rf25 /a> slot /span v176am vaL269">2269 /aaaa3L392">2f2 /a> if (!nslot /a>) {v177#m vaL311">2333333333L392">23> 1">2325 /a> string">"PERCPU: fail="cto amem_zals%s pages"="commentlock. /span v177am vaL311">233333333333333333333L392">23> 1">2322 /a> string">"72 /a h%h\n"="commermap /a>(struct ref">slot /span v177am vaL392">2398 /a> goto 9ave /a>(&chunk /a>);v1773m vaL392">2398 /a> L258">2258 /a>}v1774m vaL313">23L399">23337 ////22 /a> span classkmemleak trackscthes v177am vaL395">2369 /aaaa98 /a> ef">old /a> = (&chunk /a>);v177am vaL396">2396 /a> 1">233339ave /a>(&(& (&chunk /a>);v177am vaL337">2337 /////L258">2258 /a>}v177am va258">2258 /a>}v177am vaL269">22s2 /a> span classamem_zalsvma_rea, mapnthespagesaand copysa382">3datasss="commentlock. /span v178#m vaL311">23save /a>(&(& chunk /a>);v1781m vaL313">23save /a>(&(&< claef="+code=size"acla="stLefpu_chunk /a> * <"iode=pcpu_chunk"silistref">chunk /a>->slot /span v178am vaL392">239ave /a>(& slot /span v1783m vaf">chunk /a>);v1784m vaL313">2372 //9ave /a>(& f25 /a> nslot /a>) {v178am vaL395">2369 /aaaaunsign="clongf25 /a> nslot /a>) {v178am vaL396">2396 /a> 1">23333(unsign="clong)save /a>(&(&<_ddref="+code=size"_ddrlist/+_size /a> = 0, <"iode=pcpu_chunk"silistref">chunk /a>->slot /span v178am vaf">chunk /a>);v178am vaL298">2298 /a> 72 //9ave /a>(& f25 /a> chunk /a>);v178am vaL269">2269 /aaaa3L392">29ave /a>(& = 0, (&kl">f25 /a> slot /span v179#m vaL397">2397 /a>v179am vaL311">2333333333s2 /a> span classptesamready populzald,nthesfomemwing shouldn't>fail3ss="commentlock. /span v179am vaL392">2398 /a> 25 /a> <__pclasmap_pagesef="+code=size"__pclasmap_pagesn_loceize /a> = 0, (& 2258 /a>}v1793m vaL392">2398 /a> 69">2269 /aaaa3L392">29ave /a>(&slot /span v1794m vaL313">23L399">23f2 /25 /a> f0rf">chunk /a>);v179am vaL395">2369 /aaaa98 /a> ef">old /a> = string">"fail="cto mapn v(struct slot /span v179am va258">2258 /a>}v179am vaL337">2337 /////92 /a> span clas="commentlock. /span v1798m vaL371">2371 /a> span claaaaaaaaaaaaaaaaa* FIXME: Archscwith virtual caches hould flush em_ze="commentlock. /span v179am vaL369">2369 /a> span claaaaaaaaaaaaaaaaa* caches72 /thesaL39ar mapping here - somethingm commentlock. /span v180sm vaL369">2369 /a> span claaaaaaaaaaaaaaaaa* equivalan to flush_cache_vmapcr on thesem_ze/a ha="commentlock. /span v180am vaL371">2371 /a> span claaaaaaaaaaaaaaaaa* flush_cache_vmapcr can't>be used as most supportingm commentlock. /span v180am vaL372">2372 /a> span claaaaaaaaaaaaaaaaa* datas area_ures _re nots et>up yeta="commentlock. /span v180am vaL263">2263 /a> span claaaaaaaaaaaaaaaaa*s="commentlock. /span v1804m vaf">chunk /a>);v180am vaL395">2369 /aaaas2 /a> span classcopysa382">3datasss="commentlock. /span v180am vaL396">2396 /a> 99 /a> (& <__pv<_clasloadode=pcpu_chunk"__ v<_clasloadn_lorf25 /a> <"iode=pcpu_chunk"silistref">chunk /a>->_ claef="+code=size"a382">_ clas="sref">slot /span v180am vaL337">23L258">2258 /a>}v180am va258">2258 /a>}v180am vaL269">22s2 /a> span classwe're ready, smitc*s="commentlock. /span v181#m vaL311">23save /a>(&< r_infoode=pcpu_chunk" rfinfon_loce2 /a> string">"PERCPU: %ds%s pages/a h @%p s%zh r%zh d%zh\n"="commer258">2258 /a>}v181am vaL311">2333333333save /a>(&(struct (&<_ddref="+code=size"_ddrlistrf25 /a> <"iode=pcpu_chunk"silistref">chunk /a>->_ claef="+code=size"a382">_ clas="sr258">2258 /a>}v181am vaL392">2398 /a> 25 /a> <"iode=pcpu_chunk"silistref">chunk /a>->chunk /a>->slot /span v1813m vaf">chunk /a>);v1814m vaL313">23save /a>(&(struct (& (&<_ddref="+code=size"_ddrlistref">slot /span v181am vaL395">23goto 9ave /a>(&slot /span v181am va258">2258 /a>}v181am vasave /a>(&chunk /a>);v181am vaL298">22whil= (--25 /a> =f0rf">chunk /a>);v181am vaL269">2269 /aaaa9ave /a>(&(&(&(& slot /span v182#m vaL311">23save /a>(& slot /span v182am vaLave /a>(&chunk /a>);v182am vaL392">239ave /a>(&<7ree_bootmemode=pcpu_chunk"7reefbootmem="va/9ave /a>(&<__paode=pcpu_chunk"__pam va/9ave /a>(& < ages_ claef="+code=size"pages_ cla="stref">slot /span v1823m vaL392">23save /a>(&chunk /a>);v1824m vaL313">23return > if (!chunk /a>);v182am vaL258">2258 /a>}v182am va#endif392 /a> span classBUILD_PAGE_FIRST_CHUNKc*s="commentlock. /span v182am vaf">chunk /a>);v1828m va#ifndeff25 /a> chunk /a>);v182am vaL369">2369 /a> span clas="commentlock. /span v183sm vaL369">2369 /a> span cla* Generic SMP v183am vaL371">2371 /a> span cla*="commentlock. /span v183am vaL372">2372 /a> span cla* The embedding helper is used because its behavi2 /alosllyaresembles="commentlock. /span v183am vaL263">2263 /a> span clas thesoriginal non-dynamic generic v183am vaL264">2264 /a> span cla* important because many _rchschave _ddressing restricatars and might="commentlock. /span v183am vas2 /a> span cla* fail3i2 thes v183am vas2 /a> span cla* em_zatara As an _dded bonus, in non-NUMA cases, embedding is="commentlock. /span v183am vas2 /a> span clas gener"s=y _3good="sea TLB-wise because vpiggy back="commentlock. /span v1838m vaL371">2371 /a> span clas on thesphysi_ze/aL39ar memory mapping which uses large aagem commentlock. /span v183am vaL369">2369 /a> span cla* mappings on appli_zble _rchsa="commentlock. /span v184sm vaL369">2369 /a> span cla*s="commentlock. /span v184am vaunsign="clongf25 /a> <__ v<_clasoffsetode=pcpu_chunk"__ v<_clasoffset="st[9ave /a>(& <__read_mostlyode=pcpu_chunk"__read_mostlylistef">chunk /a>);v184am va25 /a> (&<__pv<_clasoffsetode=pcpu_chunk"__ v<_clasoffset="stref">chunk /a>);v1843m vaf">chunk /a>);v1844m vaa382">3voida*Lsave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(&rf25 /a> (&< claef="+code=size"acla="str258">2258 /a>}v184am vaL395">2369 /aaaa337 /////> 1">2392">23save /a>(&(&<_mignode=pcpu_chunk"smign="str258">2258 /a>}v184am vaf">nslot /a>) {v184am vaL337">23return > if (!<__ss="sfbootmem_noommicef="+code=size"__ss="sfbootmem_noommic="va/9ave /a>(&< claef="+code=size"acla="strLsave /a>(&<_mignode=pcpu_chunk"smign="st,f25 /a> <__paode=pcpu_chunk"__pam va/9ave /a>(&slot /span v1848m vaL258">2258 /a>}v184am va258">2258 /a>}v185#m vaa382">3voidasave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(& (&< claef="+code=size"acla="str258">2258 /a>}v1851m vaf">nslot /a>) {v185am vaL392">239ave /a>(&<7ree_bootmemode=pcpu_chunk"7reefbootmem="va/9ave /a>(&<__paode=pcpu_chunk"__pam va/9ave /a>(& slot /span v1853m vaL258">2258 /a>}v1854m vaf">chunk /a>);v185am vavoidasave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(&< etup_ v<_classreasode=pcpu_chunk" etup_ v<_classreasm va/voidr258">2258 /a>}v185am vaf">nslot /a>) {v1857m vaL313">23unsign="clongf25 /a> chunk /a>);v185am vaL298">22unsign="cintLsave /a>(&ef">chunk /a>);v185am vaL269">22intLsave /a>(&chunk /a>);v186#m vaL397">2397 /a>v186am vaL311">23s2 /a> span clas="commentlock. /span v186am vaL372">2372 /a> span claaaaaaaaa* Amways reserve _rea 72 /module v186am vaL263">2263 /a> span claaaaaaaaa* what theseegacy _mem_zaor dida="commentlock. /span v186am vaL264">2264 /a> span claaaaaaaaa*s="commentlock. /span v186am vaL395">23save /a>(&(struct (&2258 /a>}v186am vaL396">2396 /a> 1">23333 1">2392">23save /a>(& 2258 /a>}v186am vaL337">2337 /////> 1">23 1">2392">23save /a>(& < clasdflsfc_freeode=pcpu_chunk"pclasdflsfc_freem varef">slot /span v186am vaL298">22f2 /25 /a> f0rf">chunk /a>);v186am vaL269">2269 /aaaa25 /a> < amicef="+code=size"ommicm va/92 /a> string">"Fail="cto initismize vslot /span v187#m vaL397">2397 /a>v1871m vaL313">23save /a>(&(&< clasbase__ddref="+code=size" clasbase__ddrlistr-f(unsign="clong)save /a>(&<__ v<_clasa38rtode=pcpu_chunk"__ v<_clasa38rtlistef">chunk /a>);v187am vaL392">239ave /a>(&<7or_each_possible_claode=pcpu_chunk"7or_each_possible_clam va/9ave /a>(&rf">chunk /a>);v1873m vaL392">2398 /a> 25 /a> <__ v<_clasoffsetode=pcpu_chunk"__ v<_clasoffset="st[9ave /a>(&]/ef25 /a> = 0, < clasunit_offsetsef="+code=size"pclasunit_offsets="st[9ave /a>(&]ef">chunk /a>);v1874m vaL258">2258 /a>}v187am va#endif3392 /a> span classCONFIG_HAVE_SETUP_PER_CPU_AREAa*s="commentlock. /span v187am va258">2258 /a>}v187am va#else 3392 /a> span classCONFIG_SMP *s="commentlock. /span v187am va258">2258 /a>}v187am vaL369">2369 /a> span clas="commentlock. /span v188sm vaL369">2369 /a> span cla* UP v188am vaL371">2371 /a> span cla*="commentlock. /span v188am vaL372">2372 /a> span cla* UP _mways uses km-baseds v188am vaL263">2263 /a> span clas S382"> v="commentlock. /span v188am vaL264">2264 /a> span cla* varizbles _nd don't>require any specisms reparzatara="commentlock. /span v188am vas2 /a> span cla*s="commentlock. /span v188am vavoidasave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(&< etup_ v<_classreasode=pcpu_chunk" etup_ v<_classreasm va/voidr258">2258 /a>}v188am vaf">nslotk /a>);v188am vaL298">22constLsave /a>(&(&nslot /a>) {v188am vaL269">2269 /aaaa25 /a> (&(&< cla__ef="+code=size"acla__m varf25 /a> 2258 /a>}v189#m vaL311">2333333333L392">23> 1">23269 /aaaa25 /a> slot /span v189am vaL311">23 area_map /a>(struct chunk /a>);v189am vaL392">23voida*25 /a> chunk /a>);v1893m vaf">chunk /a>);v1894m vaL313">23save /a>(&<"iode=pcpu_chunk"silist/ef25 /a> < clas"s="sf"s="sfinfoode=pcpu_chunk" clas"s="sf"s="sfinfom va/1, 1ref">chunk /a>);v189am vaL395">23save /a>(& <__"s="sfbootmemode=pcpu_chunk"__"s="sfbootmem="va/9ave /a>(&(&slot /span v189am vaL396">23f2 /a> if (!<"iode=pcpu_chunk"silist/|| a> if (!2258 /a>}v189am vaL337">2337 /////95 /a> < amicef="+code=size"ommicm va/92 /a> string">"Fail="cto amem_zalsmemory 72 / vslot /span v1898m vaL313">23s2 /a> span classkmemleak trackscthes v189am vaL269">22ap /a>(struct (&slot /span v190#m vaL397">2397 /a>v1901m vaL313">23save /a>(&chunk /a>->slot /span v190am vaL392">239ave /a>(&chunk /a>->slot /span v1903m vaL392">23save /a>(&chunk /a>->slot /span v1904m vaL313">23save /a>(&<"iode=pcpu_chunk"silistref">chunk /a>-> slot /span v190am vaL395">23save /a>(&<"iode=pcpu_chunk"silistref">chunk /a>->(&slot /span v190am vaL396">23pu_chunk /a> *<"iode=pcpu_chunk"silistref">chunk /a>->(&chunk /a>);v190am vaf">chunk /a>);v190am vaL298">22f2 /25 /a> (& f0rf">chunk /a>);v190am vaL269">2269 /aaaa25 /a> < amicef="+code=size"ommicm va/92 /a> string">"Fail="cto initismize vslot /span v191#m vaL258">2258 /a>}v191am va258">2258 /a>}v191am va#endif3392 /a> span classCONFIG_SMP *s="commentlock. /span v1913m vaf">chunk /a>);v191am vaL264">2264 /a> span clas="commentlock. /span v191am vas2 /a> span cla* Firdt _nd reserved a hres _re initismized with temporary _mem_zatar="commentlock. /span v191am vas2 /a> span cla* mapnin initdatas octhat they c/a>be used be72 e slab is onaL31a="commentlock. /span v191am vas2 /a> span clas This funcatar is c_meed after slab is brought>up _nd replacescthosem commentlock. /span v1918m vaL371">2371 /a> span clas with pro v191am vaL369">2369 /a> span cla*s="commentlock. /span v192#m vavoidasave /a>(&<__initode=pcpu_chunk"__initm vaLsave /a>(&2258 /a>}v1921m vaf">nslot /a>) {v192am vaL392">23 area_map /a>(struct nslot /a>) {v1923m vaL392">2398 /a> {3save /a>(& < clasreserved_a hreode=pcpu_chunk" clasreserved_a hre="strf25 /a> slot /span v1924m vaL313">23 area_map /a>(struct slot /span v192am vaL395">23unsign="clongf25 /a> slot /span v192am vaL396">23fntLsave /a>(&slot /span v192am vaf">chunk /a>);v192am vaL298">2272 //9ave /a>(&(& (& nslotk /a>);v192am vaL269">2269 /aaaafntL*25 /a> slot /span v193#m vaL311">2333333333constLsave /a>(&(&< claef="+code=size"acla="stLefpu_chunk /a> *(&slot /span v193am va258">2258 /a>}v193am vaL392">2398 /a> 25 /a> (&< claef="+code=size"acla="stLef">f25 /a> slot /span v1933m vaf">chunk /a>);v1934m vaL313">23L399">239ave /a>(& < clasmem_zss="sode=pcpu_chunk" clasmem_zss="s="va/9ave /a>(&< claef="+code=size"acla="stref">slot /span v193am vaL395">2369 /aaaas5 /a> if (!slot /span v193am va258">2258 /a>}v193am vaL337">2337 /////95 /a> slot /span v f0r>slot /span v1838m vaL371">2371 /a> spa9 clas93/a>(&sl(voida*)save /a>(&slot /span vref">sl25 /a> ref">s>slot /span v183am vaL369">2369 /a> spa9 cla*93 < amicef="+code=size"ommicm va/9l25 /a> 984sm vaL369">2369 /a> spa9 cla*94 /a>(&slot /span v f0r>slot /span v984am vaunsign="clongf25 /9> 94de=pcpu_chunksref19c#L311" idvaL311" class=18c#L>984am va25 /a> 1843m vaf">chunk /a>);v cfooter"> T vLXR n v< hreye=sizetab iexidvilxr@hunux.noe=si. csubfooter"> kindly hosRedpill Lunpro ASe=sizeprovider of Lunux"+codul2">=k. /slockck. /spanrvi