/kernel/linux/linux-5.10/mm/ |
D | page_counter.c | 50 void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages) in page_counter_cancel() argument 54 new = atomic_long_sub_return(nr_pages, &counter->usage); in page_counter_cancel() 67 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) in page_counter_charge() argument 74 new = atomic_long_add_return(nr_pages, &c->usage); in page_counter_charge() 95 unsigned long nr_pages, in page_counter_try_charge() argument 116 new = atomic_long_add_return(nr_pages, &c->usage); in page_counter_try_charge() 118 atomic_long_sub(nr_pages, &c->usage); in page_counter_try_charge() 141 page_counter_cancel(c, nr_pages); in page_counter_try_charge() 151 void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages) in page_counter_uncharge() argument 156 page_counter_cancel(c, nr_pages); in page_counter_uncharge() [all …]
|
D | memory_hotplug.c | 234 unsigned long i, pfn, end_pfn, nr_pages; in register_page_bootmem_info_node() local 238 nr_pages = PAGE_ALIGN(sizeof(struct pglist_data)) >> PAGE_SHIFT; in register_page_bootmem_info_node() 241 for (i = 0; i < nr_pages; i++, page++) in register_page_bootmem_info_node() 261 static int check_pfn_span(unsigned long pfn, unsigned long nr_pages, in check_pfn_span() argument 280 || !IS_ALIGNED(nr_pages, min_align)) { in check_pfn_span() 282 reason, pfn, pfn + nr_pages - 1); in check_pfn_span() 289 unsigned long nr_pages) in check_hotplug_memory_addressable() argument 291 const u64 max_addr = PFN_PHYS(pfn + nr_pages) - 1; in check_hotplug_memory_addressable() 310 int __ref __add_pages(int nid, unsigned long pfn, unsigned long nr_pages, in __add_pages() argument 313 const unsigned long end_pfn = pfn + nr_pages; in __add_pages() [all …]
|
D | percpu-km.c | 50 const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT; in pcpu_create_chunk() local 60 pages = alloc_pages(gfp, order_base_2(nr_pages)); in pcpu_create_chunk() 66 for (i = 0; i < nr_pages; i++) in pcpu_create_chunk() 73 pcpu_chunk_populated(chunk, 0, nr_pages); in pcpu_create_chunk() 84 const int nr_pages = pcpu_group_sizes[0] >> PAGE_SHIFT; in pcpu_destroy_chunk() local 93 __free_pages(chunk->data, order_base_2(nr_pages)); in pcpu_destroy_chunk() 104 size_t nr_pages, alloc_pages; in pcpu_verify_alloc_info() local 112 nr_pages = (ai->groups[0].nr_units * ai->unit_size) >> PAGE_SHIFT; in pcpu_verify_alloc_info() 113 alloc_pages = roundup_pow_of_two(nr_pages); in pcpu_verify_alloc_info() 115 if (alloc_pages > nr_pages) in pcpu_verify_alloc_info() [all …]
|
D | sparse.c | 212 unsigned long nr_pages) in subsection_mask_set() argument 215 int end = subsection_map_index(pfn + nr_pages - 1); in subsection_mask_set() 220 void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages) in subsection_map_init() argument 222 int end_sec = pfn_to_section_nr(pfn + nr_pages - 1); in subsection_map_init() 225 if (!nr_pages) in subsection_map_init() 232 pfns = min(nr_pages, PAGES_PER_SECTION in subsection_map_init() 242 nr_pages -= pfns; in subsection_map_init() 246 void __init subsection_map_init(unsigned long pfn, unsigned long nr_pages) in subsection_map_init() argument 446 unsigned long nr_pages, int nid, struct vmem_altmap *altmap) in __populate_section_memmap() argument 652 unsigned long nr_pages, int nid, struct vmem_altmap *altmap) in populate_section_memmap() argument [all …]
|
D | hugetlb_cgroup.c | 164 unsigned int nr_pages; in hugetlb_cgroup_move_parent() local 178 nr_pages = compound_nr(page); in hugetlb_cgroup_move_parent() 182 page_counter_charge(&parent->hugepage[idx], nr_pages); in hugetlb_cgroup_move_parent() 186 page_counter_cancel(counter, nr_pages); in hugetlb_cgroup_move_parent() 231 static int __hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, in __hugetlb_cgroup_charge_cgroup() argument 258 nr_pages, &counter)) { in __hugetlb_cgroup_charge_cgroup() 274 int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, in hugetlb_cgroup_charge_cgroup() argument 277 return __hugetlb_cgroup_charge_cgroup(idx, nr_pages, ptr, false); in hugetlb_cgroup_charge_cgroup() 280 int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, in hugetlb_cgroup_charge_cgroup_rsvd() argument 283 return __hugetlb_cgroup_charge_cgroup(idx, nr_pages, ptr, true); in hugetlb_cgroup_charge_cgroup_rsvd() [all …]
|
D | gup_benchmark.c | 25 unsigned long nr_pages) in put_back_pages() argument 32 for (i = 0; i < nr_pages; i++) in put_back_pages() 39 unpin_user_pages(pages, nr_pages); in put_back_pages() 45 unsigned long nr_pages) in verify_dma_pinned() argument 54 for (i = 0; i < nr_pages; i++) { in verify_dma_pinned() 71 unsigned long i, nr_pages, addr, next; in __gup_benchmark_ioctl() local 81 nr_pages = gup->size / PAGE_SIZE; in __gup_benchmark_ioctl() 82 pages = kvcalloc(nr_pages, sizeof(void *), GFP_KERNEL); in __gup_benchmark_ioctl() 141 nr_pages = i; in __gup_benchmark_ioctl() 150 verify_dma_pinned(cmd, pages, nr_pages); in __gup_benchmark_ioctl() [all …]
|
D | gup.c | 1028 unsigned long start, unsigned long nr_pages, in __get_user_pages() argument 1036 if (!nr_pages) in __get_user_pages() 1075 &start, &nr_pages, i, in __get_user_pages() 1140 if (page_increm > nr_pages) in __get_user_pages() 1141 page_increm = nr_pages; in __get_user_pages() 1144 nr_pages -= page_increm; in __get_user_pages() 1145 } while (nr_pages); in __get_user_pages() 1255 unsigned long nr_pages, in __get_user_pages_locked() argument 1289 ret = __get_user_pages(mm, start, nr_pages, flags, pages, in __get_user_pages_locked() 1298 BUG_ON(ret >= nr_pages); in __get_user_pages_locked() [all …]
|
D | process_vm_access.c | 81 unsigned long nr_pages; in process_vm_rw_single_vec() local 90 nr_pages = (addr + len - 1) / PAGE_SIZE - addr / PAGE_SIZE + 1; in process_vm_rw_single_vec() 95 while (!rc && nr_pages && iov_iter_count(iter)) { in process_vm_rw_single_vec() 96 int pinned_pages = min(nr_pages, max_pages_per_loop); in process_vm_rw_single_vec() 123 nr_pages -= pinned_pages; in process_vm_rw_single_vec() 162 unsigned long nr_pages = 0; in process_vm_rw_core() local 178 nr_pages = max(nr_pages, nr_pages_iov); in process_vm_rw_core() 182 if (nr_pages == 0) in process_vm_rw_core() 185 if (nr_pages > PVM_MAX_PP_ARRAY_COUNT) { in process_vm_rw_core() 189 sizeof(struct pages *)*nr_pages), in process_vm_rw_core()
|
D | page_ext.c | 146 unsigned long nr_pages; in alloc_node_page_ext() local 148 nr_pages = NODE_DATA(nid)->node_spanned_pages; in alloc_node_page_ext() 149 if (!nr_pages) in alloc_node_page_ext() 159 nr_pages += MAX_ORDER_NR_PAGES; in alloc_node_page_ext() 161 table_size = page_ext_size * nr_pages; in alloc_node_page_ext() 293 unsigned long nr_pages, in online_page_ext() argument 300 end = SECTION_ALIGN_UP(start_pfn + nr_pages); in online_page_ext() 325 unsigned long nr_pages, int nid) in offline_page_ext() argument 330 end = SECTION_ALIGN_UP(start_pfn + nr_pages); in offline_page_ext() 347 mn->nr_pages, mn->status_change_nid); in page_ext_callback() [all …]
|
D | mlock.c | 61 int nr_pages; in clear_page_mlock() local 66 nr_pages = thp_nr_pages(page); in clear_page_mlock() 67 mod_zone_page_state(page_zone(page), NR_MLOCK, -nr_pages); in clear_page_mlock() 68 count_vm_events(UNEVICTABLE_PGCLEARED, nr_pages); in clear_page_mlock() 82 count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages); in clear_page_mlock() 99 int nr_pages = thp_nr_pages(page); in mlock_vma_page() local 101 mod_zone_page_state(page_zone(page), NR_MLOCK, nr_pages); in mlock_vma_page() 102 count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages); in mlock_vma_page() 161 int nr_pages = thp_nr_pages(page); in __munlock_isolation_failed() local 164 __count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages); in __munlock_isolation_failed() [all …]
|
/kernel/linux/linux-5.10/include/linux/ |
D | hugetlb_cgroup.h | 128 extern int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, 130 extern int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, 132 extern void hugetlb_cgroup_commit_charge(int idx, unsigned long nr_pages, 135 extern void hugetlb_cgroup_commit_charge_rsvd(int idx, unsigned long nr_pages, 138 extern void hugetlb_cgroup_uncharge_page(int idx, unsigned long nr_pages, 140 extern void hugetlb_cgroup_uncharge_page_rsvd(int idx, unsigned long nr_pages, 143 extern void hugetlb_cgroup_uncharge_cgroup(int idx, unsigned long nr_pages, 145 extern void hugetlb_cgroup_uncharge_cgroup_rsvd(int idx, unsigned long nr_pages, 153 unsigned long nr_pages, 163 unsigned long nr_pages, in hugetlb_cgroup_uncharge_file_region() argument [all …]
|
D | page_counter.h | 51 void page_counter_cancel(struct page_counter *counter, unsigned long nr_pages); 52 void page_counter_charge(struct page_counter *counter, unsigned long nr_pages); 54 unsigned long nr_pages, 56 void page_counter_uncharge(struct page_counter *counter, unsigned long nr_pages); 57 void page_counter_set_min(struct page_counter *counter, unsigned long nr_pages); 58 void page_counter_set_low(struct page_counter *counter, unsigned long nr_pages); 61 unsigned long nr_pages) in page_counter_set_high() argument 63 WRITE_ONCE(counter->high, nr_pages); in page_counter_set_high() 66 int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages); 68 unsigned long *nr_pages);
|
D | memory_hotplug.h | 112 extern int zone_grow_waitqueues(struct zone *zone, unsigned long nr_pages); 115 extern int online_pages(unsigned long pfn, unsigned long nr_pages, 147 extern void __remove_pages(unsigned long start_pfn, unsigned long nr_pages, 151 extern int __add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, 156 unsigned long nr_pages, struct mhp_params *params) in add_pages() argument 158 return __add_pages(nid, start_pfn, nr_pages, params); in add_pages() 161 int add_pages(int nid, unsigned long start_pfn, unsigned long nr_pages, 315 extern int offline_pages(unsigned long start_pfn, unsigned long nr_pages); 323 static inline int offline_pages(unsigned long start_pfn, unsigned long nr_pages) in offline_pages() argument 349 unsigned long nr_pages, [all …]
|
/kernel/linux/linux-5.10/fs/iomap/ |
D | swapfile.c | 19 unsigned long nr_pages; /* number of pages collected */ member 32 unsigned long nr_pages; in iomap_swapfile_add_extent() local 39 if (unlikely(isi->nr_pages >= isi->sis->max)) in iomap_swapfile_add_extent() 41 max_pages = isi->sis->max - isi->nr_pages; in iomap_swapfile_add_extent() 54 nr_pages = next_ppage - first_ppage; in iomap_swapfile_add_extent() 55 nr_pages = min(nr_pages, max_pages); in iomap_swapfile_add_extent() 71 error = add_swap_extent(isi->sis, isi->nr_pages, nr_pages, first_ppage); in iomap_swapfile_add_extent() 75 isi->nr_pages += nr_pages; in iomap_swapfile_add_extent() 184 if (isi.nr_pages == 0) { in iomap_swapfile_activate() 190 sis->max = isi.nr_pages; in iomap_swapfile_activate() [all …]
|
/kernel/linux/linux-5.10/drivers/media/v4l2-core/ |
D | videobuf-dma-sg.c | 63 int nr_pages) in videobuf_vmalloc_to_sg() argument 69 sglist = vzalloc(array_size(nr_pages, sizeof(*sglist))); in videobuf_vmalloc_to_sg() 72 sg_init_table(sglist, nr_pages); in videobuf_vmalloc_to_sg() 73 for (i = 0; i < nr_pages; i++, virt += PAGE_SIZE) { in videobuf_vmalloc_to_sg() 93 int nr_pages, int offset, size_t size) in videobuf_pages_to_sg() argument 100 sglist = vmalloc(array_size(nr_pages, sizeof(*sglist))); in videobuf_pages_to_sg() 103 sg_init_table(sglist, nr_pages); in videobuf_pages_to_sg() 111 for (i = 1; i < nr_pages; i++) { in videobuf_pages_to_sg() 174 dma->nr_pages = last-first+1; in videobuf_dma_init_user_locked() 175 dma->pages = kmalloc_array(dma->nr_pages, sizeof(struct page *), in videobuf_dma_init_user_locked() [all …]
|
/kernel/linux/linux-5.10/drivers/xen/ |
D | balloon.c | 402 static enum bp_state increase_reservation(unsigned long nr_pages) in increase_reservation() argument 408 if (nr_pages > ARRAY_SIZE(frame_list)) in increase_reservation() 409 nr_pages = ARRAY_SIZE(frame_list); in increase_reservation() 412 for (i = 0; i < nr_pages; i++) { in increase_reservation() 414 nr_pages = i; in increase_reservation() 422 rc = xenmem_reservation_increase(nr_pages, frame_list); in increase_reservation() 441 static enum bp_state decrease_reservation(unsigned long nr_pages, gfp_t gfp) in decrease_reservation() argument 449 if (nr_pages > ARRAY_SIZE(frame_list)) in decrease_reservation() 450 nr_pages = ARRAY_SIZE(frame_list); in decrease_reservation() 452 for (i = 0; i < nr_pages; i++) { in decrease_reservation() [all …]
|
D | unpopulated-alloc.c | 18 static int fill_list(unsigned int nr_pages) in fill_list() argument 23 unsigned int i, alloc_pages = round_up(nr_pages, PAGES_PER_SECTION); in fill_list() 111 int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages) in xen_alloc_unpopulated_pages() argument 117 if (list_count < nr_pages) { in xen_alloc_unpopulated_pages() 118 ret = fill_list(nr_pages - list_count); in xen_alloc_unpopulated_pages() 123 for (i = 0; i < nr_pages; i++) { in xen_alloc_unpopulated_pages() 159 void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages) in xen_free_unpopulated_pages() argument 164 for (i = 0; i < nr_pages; i++) { in xen_free_unpopulated_pages()
|
/kernel/linux/linux-5.10/arch/powerpc/platforms/powernv/ |
D | memtrace.c | 72 unsigned long nr_pages) in memtrace_clear_range() argument 81 for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) { in memtrace_clear_range() 89 static bool memtrace_offline_pages(u32 nid, u64 start_pfn, u64 nr_pages) in memtrace_offline_pages() argument 92 const unsigned long size = PFN_PHYS(nr_pages); in memtrace_offline_pages() 100 if (offline_pages(start_pfn, nr_pages)) { in memtrace_offline_pages() 115 u64 start_pfn, end_pfn, nr_pages, pfn; in memtrace_alloc_node() local 124 nr_pages = size >> PAGE_SHIFT; in memtrace_alloc_node() 127 end_pfn = round_down(end_pfn - nr_pages, nr_pages); in memtrace_alloc_node() 130 for (base_pfn = end_pfn; base_pfn > start_pfn; base_pfn -= nr_pages) { in memtrace_alloc_node() 131 if (memtrace_offline_pages(nid, base_pfn, nr_pages) == true) { in memtrace_alloc_node() [all …]
|
/kernel/linux/linux-5.10/net/rds/ |
D | info.c | 163 unsigned long nr_pages = 0; in rds_info_getsockopt() local 187 nr_pages = (PAGE_ALIGN(start + len) - (start & PAGE_MASK)) in rds_info_getsockopt() 190 pages = kmalloc_array(nr_pages, sizeof(struct page *), GFP_KERNEL); in rds_info_getsockopt() 195 ret = pin_user_pages_fast(start, nr_pages, FOLL_WRITE, pages); in rds_info_getsockopt() 196 if (ret != nr_pages) { in rds_info_getsockopt() 198 nr_pages = ret; in rds_info_getsockopt() 200 nr_pages = 0; in rds_info_getsockopt() 205 rdsdebug("len %d nr_pages %lu\n", len, nr_pages); in rds_info_getsockopt() 238 unpin_user_pages(pages, nr_pages); in rds_info_getsockopt()
|
D | rdma.c | 154 static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages, in rds_pin_pages() argument 163 ret = pin_user_pages_fast(user_addr, nr_pages, gup_flags, pages); in rds_pin_pages() 164 if (ret >= 0 && ret < nr_pages) { in rds_pin_pages() 178 unsigned int nr_pages; in __rds_rdma_map() local 213 nr_pages = rds_pages_in_vec(&args->vec); in __rds_rdma_map() 214 if (nr_pages == 0) { in __rds_rdma_map() 222 if ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) { in __rds_rdma_map() 228 args->vec.addr, args->vec.bytes, nr_pages); in __rds_rdma_map() 231 pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); in __rds_rdma_map() 265 ret = rds_pin_pages(args->vec.addr, nr_pages, pages, 1); in __rds_rdma_map() [all …]
|
/kernel/linux/linux-5.10/drivers/firmware/efi/libstub/ |
D | relocate.c | 29 unsigned long nr_pages; in efi_low_alloc_above() local 54 nr_pages = size / EFI_PAGE_SIZE; in efi_low_alloc_above() 69 if (desc->num_pages < nr_pages) in efi_low_alloc_above() 83 EFI_LOADER_DATA, nr_pages, &start); in efi_low_alloc_above() 129 unsigned long nr_pages; in efi_relocate_kernel() local 147 nr_pages = round_up(alloc_size, EFI_ALLOC_ALIGN) / EFI_PAGE_SIZE; in efi_relocate_kernel() 149 EFI_LOADER_DATA, nr_pages, &efi_addr); in efi_relocate_kernel()
|
/kernel/linux/linux-5.10/fs/crypto/ |
D | bio.c | 116 unsigned int nr_pages; in fscrypt_zeroout_range() local 130 nr_pages = min_t(unsigned int, ARRAY_SIZE(pages), in fscrypt_zeroout_range() 140 for (i = 0; i < nr_pages; i++) { in fscrypt_zeroout_range() 146 nr_pages = i; in fscrypt_zeroout_range() 147 if (WARN_ON(nr_pages <= 0)) in fscrypt_zeroout_range() 151 bio = bio_alloc(GFP_NOFS, nr_pages); in fscrypt_zeroout_range() 178 } while (i != nr_pages && len != 0); in fscrypt_zeroout_range() 188 for (i = 0; i < nr_pages; i++) in fscrypt_zeroout_range()
|
/kernel/linux/linux-5.10/kernel/events/ |
D | ring_buffer.c | 175 if (rb->nr_pages) in __perf_output_begin() 235 handle->page = (offset >> page_shift) & (rb->nr_pages - 1); in __perf_output_begin() 330 if (!rb->nr_pages) in ring_buffer_init() 668 pgoff_t pgoff, int nr_pages, long watermark, int flags) in rb_alloc_aux() argument 681 max_order = ilog2(nr_pages); in rb_alloc_aux() 694 rb->aux_pages = kcalloc_node(nr_pages, sizeof(void *), GFP_KERNEL, in rb_alloc_aux() 700 for (rb->aux_nr_pages = 0; rb->aux_nr_pages < nr_pages;) { in rb_alloc_aux() 704 order = min(max_order, ilog2(nr_pages - rb->aux_nr_pages)); in rb_alloc_aux() 728 rb->aux_priv = event->pmu->setup_aux(event, rb->aux_pages, nr_pages, in rb_alloc_aux() 747 rb->aux_watermark = nr_pages << (PAGE_SHIFT - 1); in rb_alloc_aux() [all …]
|
/kernel/linux/linux-5.10/tools/testing/selftests/vm/ |
D | userfaultfd.c | 64 static unsigned long nr_cpus, nr_pages, nr_pages_per_cpu, page_size; variable 174 if (madvise(rel_area, nr_pages * page_size, MADV_DONTNEED)) { in anon_release_pages() 184 *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, in anon_allocate_area() 203 nr_pages * page_size, in hugetlb_release_pages() 204 nr_pages * page_size)) { in hugetlb_release_pages() 217 *alloc_area = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, in hugetlb_allocate_area() 221 nr_pages * page_size); in hugetlb_allocate_area() 228 area_alias = mmap(NULL, nr_pages * page_size, PROT_READ | PROT_WRITE, in hugetlb_allocate_area() 231 nr_pages * page_size); in hugetlb_allocate_area() 250 if (munmap(*alloc_area, nr_pages * page_size) < 0) { in hugetlb_allocate_area() [all …]
|
/kernel/linux/linux-5.10/drivers/dma-buf/heaps/ |
D | cma_heap.c | 32 unsigned long nr_pages = buffer->pagecount; in cma_heap_free() local 38 cma_release(cma_heap->cma, cma_pages, nr_pages); in cma_heap_free() 52 unsigned long nr_pages = size >> PAGE_SHIFT; in cma_heap_allocate() local 69 cma_pages = cma_alloc(cma_heap->cma, nr_pages, align, false); in cma_heap_allocate() 74 unsigned long nr_clear_pages = nr_pages; in cma_heap_allocate() 96 helper_buffer->pagecount = nr_pages; in cma_heap_allocate() 130 cma_release(cma_heap->cma, cma_pages, nr_pages); in cma_heap_allocate()
|