mempolicy.c (6421ec764a62c51f810c5dc40cd45eeb15801ad9) | mempolicy.c (eb35073960510762dee417574589b7a8971c68ab) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Simple NUMA memory policy for the Linux kernel. 4 * 5 * Copyright 2003,2004 Andi Kleen, SuSE Labs. 6 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc. 7 * 8 * NUMA policy allows the user to give hints in which node(s) memory should --- 2139 unchanged lines hidden (view full) --- 2148 preempt_disable(); 2149 __inc_numa_state(page_zone(page), NUMA_INTERLEAVE_HIT); 2150 preempt_enable(); 2151 } 2152 return page; 2153} 2154 2155/** | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Simple NUMA memory policy for the Linux kernel. 4 * 5 * Copyright 2003,2004 Andi Kleen, SuSE Labs. 6 * (C) Copyright 2005 Christoph Lameter, Silicon Graphics, Inc. 7 * 8 * NUMA policy allows the user to give hints in which node(s) memory should --- 2139 unchanged lines hidden (view full) --- 2148 preempt_disable(); 2149 __inc_numa_state(page_zone(page), NUMA_INTERLEAVE_HIT); 2150 preempt_enable(); 2151 } 2152 return page; 2153} 2154 2155/** |
2156 * alloc_pages_vma - Allocate a page for a VMA. | 2156 * alloc_pages_vma - Allocate a page for a VMA. 2157 * @gfp: GFP flags. 2158 * @order: Order of the GFP allocation. 2159 * @vma: Pointer to VMA or NULL if not available. 2160 * @addr: Virtual address of the allocation. Must be inside @vma. 2161 * @node: Which node to prefer for allocation (modulo policy). 2162 * @hugepage: For hugepages try only the preferred node if possible. |
2157 * | 2163 * |
2158 * @gfp: 2159 * %GFP_USER user allocation. 2160 * %GFP_KERNEL kernel allocations, 2161 * %GFP_HIGHMEM highmem/user allocations, 2162 * %GFP_FS allocation should not call back into a file system. 2163 * %GFP_ATOMIC don't sleep. | 2164 * Allocate a page for a specific address in @vma, using the appropriate 2165 * NUMA policy. When @vma is not NULL the caller must hold the mmap_lock 2166 * of the mm_struct of the VMA to prevent it from going away. Should be 2167 * used for all allocations for pages that will be mapped into user space. |
2164 * | 2168 * |
2165 * @order:Order of the GFP allocation. 2166 * @vma: Pointer to VMA or NULL if not available. 2167 * @addr: Virtual Address of the allocation. Must be inside the VMA. 2168 * @node: Which node to prefer for allocation (modulo policy). 2169 * @hugepage: for hugepages try only the preferred node if possible 2170 * 2171 * This function allocates a page from the kernel page pool and applies 2172 * a NUMA policy associated with the VMA or the current process. 2173 * When VMA is not NULL caller must read-lock the mmap_lock of the 2174 * mm_struct of the VMA to prevent it from going away. Should be used for 2175 * all allocations for pages that will be mapped into user space. Returns 2176 * NULL when no page can be allocated. | 2169 * Return: The page on success or NULL if allocation fails. |
2177 */ | 2170 */ |
2178struct page * 2179alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, | 2171struct page *alloc_pages_vma(gfp_t gfp, int order, struct vm_area_struct *vma, |
2180 unsigned long addr, int node, bool hugepage) 2181{ 2182 struct mempolicy *pol; 2183 struct page *page; 2184 int preferred_nid; 2185 nodemask_t *nmask; 2186 2187 pol = get_vma_policy(vma, addr); --- 878 unchanged lines hidden --- | 2172 unsigned long addr, int node, bool hugepage) 2173{ 2174 struct mempolicy *pol; 2175 struct page *page; 2176 int preferred_nid; 2177 nodemask_t *nmask; 2178 2179 pol = get_vma_policy(vma, addr); --- 878 unchanged lines hidden --- |