| /linux/io_uring/ |
| H A D | memmap.c | 18 static bool io_mem_alloc_compound(struct page **pages, int nr_pages, in io_mem_alloc_compound() argument 38 extra = nr_compound - nr_pages; in io_mem_alloc_compound() 49 for (i = 0; i < nr_pages; i++) in io_mem_alloc_compound() 57 unsigned long start, end, nr_pages; in io_pin_pages() local 68 nr_pages = end - start; in io_pin_pages() 69 if (WARN_ON_ONCE(!nr_pages)) in io_pin_pages() 71 if (nr_pages > INT_MAX / sizeof(struct page *)) in io_pin_pages() 74 pages = kvmalloc_objs(struct page *, nr_pages, GFP_KERNEL_ACCOUNT); in io_pin_pages() 78 ret = pin_user_pages_fast(uaddr, nr_pages, FOLL_WRITE | FOLL_LONGTERM, in io_pin_pages() 81 if (ret == nr_pages) { in io_pin_pages() 161 int nr_pages; io_region_pin_pages() local 211 int nr_pages, ret; io_create_region() local 312 unsigned long nr_pages = min(mr->nr_pages, max_pages); io_region_mmap() local [all...] |
| /linux/fs/iomap/ |
| H A D | swapfile.c | 16 unsigned long nr_pages; /* number of pages collected */ member 30 unsigned long nr_pages; in iomap_swapfile_add_extent() local 37 if (unlikely(isi->nr_pages >= isi->sis->max)) in iomap_swapfile_add_extent() 39 max_pages = isi->sis->max - isi->nr_pages; in iomap_swapfile_add_extent() 52 nr_pages = next_ppage - first_ppage; in iomap_swapfile_add_extent() 53 nr_pages = min(nr_pages, max_pages); in iomap_swapfile_add_extent() 69 error = add_swap_extent(isi->sis, isi->nr_pages, nr_pages, first_ppage); in iomap_swapfile_add_extent() 73 isi->nr_pages += nr_pages; in iomap_swapfile_add_extent() 182 if (isi.nr_pages == 0) { in iomap_swapfile_activate() 188 sis->max = isi.nr_pages; in iomap_swapfile_activate() [all …]
|
| /linux/mm/ |
| H A D | gup_test.c | 18 unsigned long nr_pages, unsigned int gup_test_flags) in put_back_pages() argument 25 for (i = 0; i < nr_pages; i++) in put_back_pages() 32 unpin_user_pages(pages, nr_pages); in put_back_pages() 36 unpin_user_pages(pages, nr_pages); in put_back_pages() 38 for (i = 0; i < nr_pages; i++) in put_back_pages() 47 unsigned long nr_pages) in verify_dma_pinned() argument 56 for (i = 0; i < nr_pages; i++) { in verify_dma_pinned() 77 unsigned long nr_pages) in dump_pages_test() argument 87 if (gup->which_pages[i] > nr_pages) { in dump_pages_test() 111 unsigned long i, nr_pages, addr, next; in __gup_test_ioctl() local [all …]
|
| H A D | hugetlb_cgroup.c | 192 unsigned int nr_pages; in hugetlb_cgroup_move_parent() local 206 nr_pages = folio_nr_pages(folio); in hugetlb_cgroup_move_parent() 210 page_counter_charge(&parent->hugepage[idx], nr_pages); in hugetlb_cgroup_move_parent() 214 page_counter_cancel(counter, nr_pages); in hugetlb_cgroup_move_parent() 256 static int __hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, in __hugetlb_cgroup_charge_cgroup() argument 277 nr_pages, &counter)) { in __hugetlb_cgroup_charge_cgroup() 293 int hugetlb_cgroup_charge_cgroup(int idx, unsigned long nr_pages, in hugetlb_cgroup_charge_cgroup() argument 296 return __hugetlb_cgroup_charge_cgroup(idx, nr_pages, ptr, false); in hugetlb_cgroup_charge_cgroup() 299 int hugetlb_cgroup_charge_cgroup_rsvd(int idx, unsigned long nr_pages, in hugetlb_cgroup_charge_cgroup_rsvd() argument 302 return __hugetlb_cgroup_charge_cgroup(idx, nr_pages, ptr, true); in hugetlb_cgroup_charge_cgroup_rsvd() [all …]
|
| H A D | cma.h | 85 void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages); 86 void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages); 87 void cma_sysfs_account_release_pages(struct cma *cma, unsigned long nr_pages); 90 unsigned long nr_pages) {}; in cma_sysfs_account_success_pages() argument 92 unsigned long nr_pages) {}; in cma_sysfs_account_fail_pages() argument 94 unsigned long nr_pages) {}; in cma_sysfs_account_release_pages() argument
|
| H A D | rmap.c | 939 if (pvmw.pte && ptes != pvmw.nr_pages) in folio_referenced_one() 1007 if (ptes == pvmw.nr_pages) { in folio_referenced_one() 1236 unsigned long nr_pages; member 1245 .nr_pages = state->nr_pages, in mapping_wrprotect_range_one() 1259 pgoff_t pgoff_start, unsigned long nr_pages, 1283 unsigned long pfn, unsigned long nr_pages) in mapping_wrprotect_range() argument 1289 .nr_pages = nr_pages, in mapping_wrprotect_range() 1300 __rmap_walk_file(/* folio = */NULL, mapping, pgoff, nr_pages, &rwc, in mapping_wrprotect_range() 1319 int pfn_mkclean_range(unsigned long pfn, unsigned long nr_pages, pgoff_t pgoff, in pfn_mkclean_range() argument 1324 .nr_pages = nr_pages, in pfn_mkclean_range() [all …]
|
| H A D | memcontrol-v1.h | 79 void memcg1_account_kmem(struct mem_cgroup *memcg, int nr_pages); 84 bool memcg1_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages, 86 static inline void memcg1_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages) in memcg1_uncharge_skmem() argument 88 page_counter_uncharge(&memcg->tcpmem, nr_pages); in memcg1_uncharge_skmem() 122 static inline void memcg1_account_kmem(struct mem_cgroup *memcg, int nr_pages) {} in memcg1_account_kmem() argument 124 static inline bool memcg1_charge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages, in memcg1_charge_skmem() argument 126 static inline void memcg1_uncharge_skmem(struct mem_cgroup *memcg, unsigned int nr_pages) {} in memcg1_uncharge_skmem() argument
|
| H A D | page_ext.c | 192 unsigned long nr_pages; in alloc_node_page_ext() local 194 nr_pages = NODE_DATA(nid)->node_spanned_pages; in alloc_node_page_ext() 195 if (!nr_pages) in alloc_node_page_ext() 205 nr_pages += MAX_ORDER_NR_PAGES; in alloc_node_page_ext() 207 table_size = page_ext_size * nr_pages; in alloc_node_page_ext() 371 unsigned long nr_pages) in online_page_ext() argument 378 end = SECTION_ALIGN_UP(start_pfn + nr_pages); in online_page_ext() 394 unsigned long nr_pages) in offline_page_ext() argument 399 end = SECTION_ALIGN_UP(start_pfn + nr_pages); in offline_page_ext() 427 ret = online_page_ext(mn->start_pfn, mn->nr_pages); in page_ext_callback() [all …]
|
| H A D | memcontrol.c | 139 static void memcg_uncharge(struct mem_cgroup *memcg, unsigned int nr_pages); 141 static void memcg_uncharge_kmem(struct mem_cgroup *memcg, unsigned int nr_pages) in memcg_uncharge_kmem() argument 143 mod_memcg_state(memcg, MEMCG_KMEM, -nr_pages); in memcg_uncharge_kmem() 144 memcg1_account_kmem(memcg, -nr_pages); in memcg_uncharge_kmem() 146 memcg_uncharge(memcg, nr_pages); in memcg_uncharge_kmem() 153 unsigned int nr_pages; in obj_cgroup_release() local 178 nr_pages = nr_bytes >> PAGE_SHIFT; in obj_cgroup_release() 180 if (nr_pages) { in obj_cgroup_release() 184 memcg_uncharge_kmem(memcg, nr_pages); in obj_cgroup_release() 1529 int zid, long nr_pages) in mem_cgroup_update_lru_size() argument [all …]
|
| H A D | swap_state.c | 213 unsigned long nr_pages = folio_nr_pages(folio); in __swap_cache_do_add_folio() local 221 ci_end = ci_off + nr_pages; in __swap_cache_do_add_folio() 228 folio_ref_add(folio, nr_pages); in __swap_cache_do_add_folio() 250 unsigned long nr_pages = folio_nr_pages(folio); in __swap_cache_add_folio() local 253 node_stat_mod_folio(folio, NR_FILE_PAGES, nr_pages); in __swap_cache_add_folio() 254 lruvec_stat_mod_folio(folio, NR_SWAPCACHE, nr_pages); in __swap_cache_add_folio() 265 unsigned long nr_pages = folio_nr_pages(folio); in __swap_cache_do_del_folio() local 274 ci_end = ci_start + nr_pages; in __swap_cache_do_del_folio() 293 __swap_cluster_free_entries(si, ci, ci_start, nr_pages); in __swap_cache_do_del_folio() 319 unsigned long nr_pages = folio_nr_pages(folio); in __swap_cache_del_folio() local [all …]
|
| H A D | migrate.c | 1649 int rc, nr_pages; in migrate_hugetlbs() local 1659 nr_pages = folio_nr_pages(folio); in migrate_hugetlbs() 1672 stats->nr_failed_pages += nr_pages; in migrate_hugetlbs() 1694 stats->nr_failed_pages += nr_pages + nr_retry_pages; in migrate_hugetlbs() 1698 nr_retry_pages += nr_pages; in migrate_hugetlbs() 1701 stats->nr_succeeded += nr_pages; in migrate_hugetlbs() 1711 stats->nr_failed_pages += nr_pages; in migrate_hugetlbs() 1738 int nr_pages; in migrate_folios_move() local 1745 nr_pages = folio_nr_pages(folio); in migrate_folios_move() 1762 *nr_retry_pages += nr_pages; in migrate_folios_move() [all …]
|
| H A D | gup.c | 1355 unsigned long start, unsigned long nr_pages, in __get_user_pages() argument 1363 if (!nr_pages) in __get_user_pages() 1460 if (page_increm > nr_pages) in __get_user_pages() 1461 page_increm = nr_pages; in __get_user_pages() 1506 nr_pages -= page_increm; in __get_user_pages() 1507 } while (nr_pages); in __get_user_pages() 1651 unsigned long nr_pages, in __get_user_pages_locked() argument 1659 if (!nr_pages) in __get_user_pages_locked() 1692 ret = __get_user_pages(mm, start, nr_pages, flags, pages, in __get_user_pages_locked() 1701 VM_WARN_ON_ONCE(!*locked && (ret < 0 || ret >= nr_pages)); in __get_user_pages_locked() [all …]
|
| H A D | mlock.c | 124 int nr_pages = folio_nr_pages(folio); in __munlock_folio() local 144 zone_stat_mod_folio(folio, NR_MLOCK, -nr_pages); in __munlock_folio() 146 __count_vm_events(UNEVICTABLE_PGMUNLOCKED, nr_pages); in __munlock_folio() 148 __count_vm_events(UNEVICTABLE_PGSTRANDED, nr_pages); in __munlock_folio() 156 __count_vm_events(UNEVICTABLE_PGRESCUED, nr_pages); in __munlock_folio() 250 int nr_pages = folio_nr_pages(folio); in mlock_folio() local 252 zone_stat_mod_folio(folio, NR_MLOCK, nr_pages); in mlock_folio() 253 __count_vm_events(UNEVICTABLE_PGMLOCKED, nr_pages); in mlock_folio() 270 int nr_pages = folio_nr_pages(folio); in mlock_new_folio() local 276 zone_stat_mod_folio(folio, NR_MLOCK, nr_pages); in mlock_new_folio() [all …]
|
| H A D | secretmem.c | 58 unsigned long nr_pages) in __secretmem_account_pages() argument 62 if (!nr_pages) in __secretmem_account_pages() 69 new_pages = cur_pages + nr_pages; in __secretmem_account_pages() 80 const unsigned long nr_pages = folio_nr_pages(folio); in secretmem_account_folio() local 82 if (!__secretmem_account_pages(state->user, nr_pages)) in secretmem_account_folio() 85 atomic_long_add(nr_pages, &state->nr_pages_accounted); in secretmem_account_folio() 90 unsigned long nr_pages) in __secretmem_unaccount_pages() argument 92 atomic_long_sub(nr_pages, &state->user->locked_vm); in __secretmem_unaccount_pages() 93 atomic_long_sub(nr_pages, &state->nr_pages_accounted); in __secretmem_unaccount_pages()
|
| /linux/include/linux/ |
| H A D | rmap.h | 332 const struct page *page, int nr_pages, enum pgtable_level level) in __folio_rmap_sanity_checks() argument 349 VM_WARN_ON_ONCE(nr_pages <= 0); in __folio_rmap_sanity_checks() 351 VM_WARN_ON_FOLIO(page_folio(page + nr_pages - 1) != folio, folio); in __folio_rmap_sanity_checks() 363 VM_WARN_ON_FOLIO(nr_pages != HPAGE_PMD_NR, folio); in __folio_rmap_sanity_checks() 371 VM_WARN_ON_FOLIO(nr_pages != HPAGE_PUD_NR, folio); in __folio_rmap_sanity_checks() 404 void folio_add_anon_rmap_ptes(struct folio *, struct page *, int nr_pages, 412 void folio_add_file_rmap_ptes(struct folio *, struct page *, int nr_pages, 420 void folio_remove_rmap_ptes(struct folio *, struct page *, int nr_pages, 493 struct page *page, int nr_pages, struct vm_area_struct *dst_vma, in __folio_dup_file_rmap() argument 496 const int orig_nr_pages = nr_pages; in __folio_dup_file_rmap() [all …]
|
| /linux/drivers/xen/ |
| H A D | unpopulated-alloc.c | 37 static int fill_list(unsigned int nr_pages) in fill_list() argument 42 unsigned int i, alloc_pages = round_up(nr_pages, PAGES_PER_SECTION); in fill_list() 161 int xen_alloc_unpopulated_pages(unsigned int nr_pages, struct page **pages) in xen_alloc_unpopulated_pages() argument 172 return xen_alloc_ballooned_pages(nr_pages, pages); in xen_alloc_unpopulated_pages() 175 if (list_count < nr_pages) { in xen_alloc_unpopulated_pages() 176 ret = fill_list(nr_pages - list_count); in xen_alloc_unpopulated_pages() 181 for (i = 0; i < nr_pages; i++) { in xen_alloc_unpopulated_pages() 217 void xen_free_unpopulated_pages(unsigned int nr_pages, struct page **pages) in xen_free_unpopulated_pages() argument 222 xen_free_ballooned_pages(nr_pages, pages); in xen_free_unpopulated_pages() 227 for (i = 0; i < nr_pages; i++) { in xen_free_unpopulated_pages()
|
| /linux/kernel/events/ |
| H A D | ring_buffer.c | 179 if (rb->nr_pages) { in __perf_output_begin() 243 handle->page = (offset >> page_shift) & (rb->nr_pages - 1); in __perf_output_begin() 338 if (!rb->nr_pages) in ring_buffer_init() 684 pgoff_t pgoff, int nr_pages, long watermark, int flags) in rb_alloc_aux() 701 if (nr_pages <= 0) in rb_alloc_aux() 712 (unsigned long)nr_pages << (PAGE_SHIFT - 1)); in rb_alloc_aux() 723 * max_order that fits in nr_pages, not the other way around, in rb_alloc_aux() 727 max_order = ilog2(nr_pages); in rb_alloc_aux() 735 if (get_order((unsigned long)nr_pages * sizeof(void *)) > MAX_PAGE_ORDER) in rb_alloc_aux() 737 rb->aux_pages = kcalloc_node(nr_pages, sizeo in rb_alloc_aux() 685 rb_alloc_aux(struct perf_buffer * rb,struct perf_event * event,pgoff_t pgoff,int nr_pages,long watermark,int flags) rb_alloc_aux() argument 843 rb_alloc(int nr_pages,long watermark,int cpu,int flags) rb_alloc() argument 925 rb_alloc(int nr_pages,long watermark,int cpu,int flags) rb_alloc() argument [all...] |
| /linux/mm/kasan/ |
| H A D | shadow.c | 220 nr_shadow_pages = mem_data->nr_pages >> KASAN_SHADOW_SCALE_SHIFT; in kasan_mem_notifier() 226 if (WARN_ON(mem_data->nr_pages % KASAN_GRANULE_SIZE) || in kasan_mem_notifier() 327 static void ___free_pages_bulk(struct page **pages, int nr_pages) in ___free_pages_bulk() argument 331 for (i = 0; i < nr_pages; i++) { in ___free_pages_bulk() 339 static int ___alloc_pages_bulk(struct page **pages, int nr_pages, gfp_t gfp_mask) in ___alloc_pages_bulk() argument 341 unsigned long nr_populated, nr_total = nr_pages; in ___alloc_pages_bulk() 344 while (nr_pages) { in ___alloc_pages_bulk() 345 nr_populated = alloc_pages_bulk(gfp_mask, nr_pages, pages); in ___alloc_pages_bulk() 347 ___free_pages_bulk(page_array, nr_total - nr_pages); in ___alloc_pages_bulk() 351 nr_pages -= nr_populated; in ___alloc_pages_bulk() [all …]
|
| /linux/drivers/misc/bcm-vk/ |
| H A D | bcm_vk_sg.c | 60 dma->nr_pages = last - first + 1; in bcm_vk_dma_alloc() 63 dma->pages = kmalloc_objs(struct page *, dma->nr_pages); in bcm_vk_dma_alloc() 68 data, vkdata->size, dma->nr_pages); in bcm_vk_dma_alloc() 74 dma->nr_pages, in bcm_vk_dma_alloc() 77 if (err != dma->nr_pages) { in bcm_vk_dma_alloc() 78 dma->nr_pages = (err >= 0) ? err : 0; in bcm_vk_dma_alloc() 80 err, dma->nr_pages); in bcm_vk_dma_alloc() 85 dma->sglen = (dma->nr_pages * sizeof(*sgdata)) + in bcm_vk_dma_alloc() 115 for (i = 1; i < dma->nr_pages; i++) { in bcm_vk_dma_alloc() 248 for (i = 0; i < dma->nr_pages; i++) in bcm_vk_dma_free()
|
| /linux/net/rds/ |
| H A D | rdma.c | 155 static int rds_pin_pages(unsigned long user_addr, unsigned int nr_pages, in rds_pin_pages() argument 164 ret = pin_user_pages_fast(user_addr, nr_pages, gup_flags, pages); in rds_pin_pages() 165 if (ret >= 0 && ret < nr_pages) { in rds_pin_pages() 179 unsigned int nr_pages; in __rds_rdma_map() local 214 nr_pages = rds_pages_in_vec(&args->vec); in __rds_rdma_map() 215 if (nr_pages == 0) { in __rds_rdma_map() 223 if ((nr_pages - 1) > (RDS_MAX_MSG_SIZE >> PAGE_SHIFT)) { in __rds_rdma_map() 229 args->vec.addr, args->vec.bytes, nr_pages); in __rds_rdma_map() 232 pages = kzalloc_objs(struct page *, nr_pages); in __rds_rdma_map() 270 ret = rds_pin_pages(args->vec.addr, nr_pages, pages, 1); in __rds_rdma_map() [all …]
|
| /linux/fs/ |
| H A D | fs-writeback.c | 39 long nr_pages; member 1066 static long wb_split_bdi_pages(struct bdi_writeback *wb, long nr_pages) in wb_split_bdi_pages() argument 1071 if (nr_pages == LONG_MAX) in wb_split_bdi_pages() 1080 return nr_pages; in wb_split_bdi_pages() 1082 return DIV_ROUND_UP_ULL((u64)nr_pages * this_bw, tot_bw); in wb_split_bdi_pages() 1111 long nr_pages; in bdi_split_work_to_wbs() local 1126 nr_pages = wb_split_bdi_pages(wb, base_work->nr_pages); in bdi_split_work_to_wbs() 1131 work->nr_pages = nr_pages; in bdi_split_work_to_wbs() 1150 work->nr_pages = nr_pages; in bdi_split_work_to_wbs() 1228 work->nr_pages = dirty; in cgroup_writeback_by_id() [all …]
|
| /linux/drivers/firmware/efi/libstub/ |
| H A D | mem.c | 119 unsigned long nr_pages; in efi_free() local 124 nr_pages = round_up(size, EFI_ALLOC_ALIGN) / EFI_PAGE_SIZE; in efi_free() 125 efi_bs_call(free_pages, addr, nr_pages); in efi_free() 148 unsigned long nr_pages; in efi_low_alloc_above() local 165 nr_pages = size / EFI_PAGE_SIZE; in efi_low_alloc_above() 183 if (desc->num_pages < nr_pages) in efi_low_alloc_above() 197 EFI_LOADER_DATA, nr_pages, &start); in efi_low_alloc_above()
|
| /linux/drivers/virt/acrn/ |
| H A D | mm.c | 159 int nr_pages, i, order, nr_regions = 0; in acrn_vm_ram_map() local 172 nr_pages = memmap->len >> PAGE_SHIFT; in acrn_vm_ram_map() 173 if (!nr_pages) in acrn_vm_ram_map() 187 for (i = 0; i < nr_pages; i++) { in acrn_vm_ram_map() 237 pages = vzalloc(array_size(nr_pages, sizeof(*pages))); in acrn_vm_ram_map() 243 nr_pages, FOLL_WRITE | FOLL_LONGTERM, in acrn_vm_ram_map() 248 } else if (pinned != nr_pages) { in acrn_vm_ram_map() 254 remap_vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL); in acrn_vm_ram_map() 265 region_mapping->npages = nr_pages; in acrn_vm_ram_map() 280 for (i = 0; i < nr_pages; i += 1 << order) { in acrn_vm_ram_map() [all …]
|
| /linux/arch/arm/mach-rpc/include/mach/ |
| H A D | uncompress.h | 20 unsigned long nr_pages; member 116 unsigned int nr_pages = 0, page_size = PAGE_SIZE; in arch_decomp_setup() local 130 nr_pages += (t->u.mem.size / PAGE_SIZE); in arch_decomp_setup() 134 nr_pages = params->nr_pages; in arch_decomp_setup() 179 if (nr_pages * page_size < 4096*1024) error("<4M of mem\n"); in arch_decomp_setup()
|
| /linux/drivers/xen/xenbus/ |
| H A D | xenbus_client.c | 396 unsigned int nr_pages, grant_ref_t *grefs) in xenbus_setup_ring() argument 398 unsigned long ring_size = nr_pages * XEN_PAGE_SIZE; in xenbus_setup_ring() 410 ret = gnttab_alloc_grant_references(nr_pages, &gref_head); in xenbus_setup_ring() 413 nr_pages); in xenbus_setup_ring() 417 for (i = 0; i < nr_pages; i++) { in xenbus_setup_ring() 437 for (i = 0; i < nr_pages; i++) in xenbus_setup_ring() 454 void xenbus_teardown_ring(void **vaddr, unsigned int nr_pages, in xenbus_teardown_ring() argument 459 for (i = 0; i < nr_pages; i++) { in xenbus_teardown_ring() 467 free_pages_exact(*vaddr, nr_pages * XEN_PAGE_SIZE); in xenbus_teardown_ring() 684 unsigned int nr_pages = XENBUS_PAGES(nr_grefs); in xenbus_map_ring_hvm() local [all …]
|