| /linux/tools/testing/selftests/mm/ |
| H A D | hmm-tests.c | 194 unsigned long npages) in hmm_dmirror_cmd() 202 cmd.npages = npages; in hmm_dmirror_cmd() 332 unsigned long npages) in TEST_F() 334 return hmm_dmirror_cmd(fd, HMM_DMIRROR_MIGRATE_TO_DEV, buffer, npages); in TEST_F() 339 unsigned long npages) in TEST_F() 341 return hmm_dmirror_cmd(fd, HMM_DMIRROR_MIGRATE_TO_SYS, buffer, npages); in TEST_F() 357 unsigned long npages; in TEST_F() 364 npages = ALIGN(HMM_BUFFER_SIZE, self->page_size) >> self->page_shift; 365 ASSERT_NE(npages, 190 hmm_dmirror_cmd(int fd,unsigned long request,struct hmm_buffer * buffer,unsigned long npages) hmm_dmirror_cmd() argument 281 hmm_migrate_sys_to_dev(int fd,struct hmm_buffer * buffer,unsigned long npages) hmm_migrate_sys_to_dev() argument 288 hmm_migrate_dev_to_sys(int fd,struct hmm_buffer * buffer,unsigned long npages) hmm_migrate_dev_to_sys() argument 306 unsigned long npages; TEST_F() local 370 unsigned long npages; TEST_F() local 429 unsigned long npages; TEST_F() local 477 unsigned long npages; TEST_F() local 545 unsigned long npages; TEST_F() local 652 unsigned long npages; TEST_F() local 729 unsigned long npages; TEST_F() local 785 unsigned long npages; TEST_F() local 840 unsigned long npages; TEST_F() local 895 unsigned long npages; TEST_F() local 953 unsigned long npages; TEST_F() local 999 unsigned long npages; TEST_F() local 1051 unsigned long npages; TEST_F() local 1107 unsigned long npages; TEST_F() local 1159 unsigned long npages; TEST_F() local 1194 unsigned long npages; TEST_F() local 1286 unsigned long npages; TEST_F() local 1345 unsigned long npages; TEST_F() local 1407 unsigned long npages; TEST_F() local 1469 unsigned long npages; TEST_F() local 1511 unsigned long npages; TEST_F() local 1613 unsigned long npages; TEST_F() local 1701 unsigned long npages; TEST_F() local 1776 unsigned long npages; TEST_F() local 1830 unsigned long npages; TEST_F() local 1883 unsigned long npages; TEST_F() local 1954 gup_test_exec(int gup_fd,unsigned long addr,int cmd,int npages,int size,int flags) gup_test_exec() argument 1982 unsigned long npages; TEST_F() local 2070 unsigned long npages; TEST_F() local 2145 unsigned long npages; TEST_F() local 2196 unsigned long npages; TEST_F() local 2260 unsigned long npages; TEST_F() local 2319 unsigned long npages; TEST_F() local 2408 unsigned long npages; TEST_F() local 2483 unsigned long npages; TEST_F() local 2583 unsigned long npages; TEST_F() local 2678 unsigned long npages; TEST_F() local 2820 unsigned long npages = buffer_size / sysconf(_SC_PAGESIZE); run_migration_benchmark() local [all...] |
| /linux/drivers/gpu/drm/ |
| H A D | drm_pagemap.c | 175 static void drm_pagemap_migration_unlock_put_pages(unsigned long npages, in drm_pagemap_migration_unlock_put_pages() argument 180 for (i = 0; i < npages;) { in drm_pagemap_migration_unlock_put_pages() 241 unsigned long npages, in drm_pagemap_migrate_map_device_private_pages() argument 247 for (i = 0; i < npages;) { in drm_pagemap_migrate_map_device_private_pages() 328 unsigned long npages, in drm_pagemap_migrate_map_system_pages() argument 335 for (i = 0; i < npages;) { in drm_pagemap_migrate_map_system_pages() 350 0, npages * PAGE_SIZE); in drm_pagemap_migrate_map_system_pages() 404 unsigned long npages, in drm_pagemap_migrate_unmap_pages() argument 415 for (i = 0; i < npages;) { in drm_pagemap_migrate_unmap_pages() 449 unsigned long npages, in drm_pagemap_migrate_remote_to_local() argument [all …]
|
| /linux/lib/tests/ |
| H A D | kunit_iov_iter.c | 53 size_t npages) in iov_kunit_create_buffer() argument 60 pages = kzalloc_objs(struct page *, npages, GFP_KERNEL); in iov_kunit_create_buffer() 67 got = alloc_pages_bulk(GFP_KERNEL, npages, pages); in iov_kunit_create_buffer() 69 if (last == got || got == npages) in iov_kunit_create_buffer() 73 if (got != npages) { in iov_kunit_create_buffer() 76 KUNIT_ASSERT_EQ(test, got, npages); in iov_kunit_create_buffer() 79 for (i = 0; i < npages / 4; ++i) in iov_kunit_create_buffer() 80 swap(pages[i], pages[i + npages / 2]); in iov_kunit_create_buffer() 82 buffer = vmap(pages, npages, VM_MAP | VM_MAP_PUT_PAGES, PAGE_KERNEL); in iov_kunit_create_buffer() 126 size_t bufsize, npages, size, copied; in iov_kunit_copy_to_kvec() local [all …]
|
| /linux/drivers/infiniband/hw/hfi1/ |
| H A D | user_pages.c | 30 u32 nlocked, u32 npages) in hfi1_can_pin_pages() argument 47 if (atomic64_read(&mm->pinned_vm) + npages > ulimit_pages) in hfi1_can_pin_pages() 66 if (nlocked + npages > (ulimit_pages / usr_ctxts / 4)) in hfi1_can_pin_pages() 74 if (nlocked + npages > cache_limit_pages) in hfi1_can_pin_pages() 80 int hfi1_acquire_user_pages(struct mm_struct *mm, unsigned long vaddr, size_t npages, in hfi1_acquire_user_pages() argument 86 ret = pin_user_pages_fast(vaddr, npages, gup_flags, pages); in hfi1_acquire_user_pages() 96 size_t npages, bool dirty) in hfi1_release_user_pages() argument 98 unpin_user_pages_dirty_lock(p, npages, dirty); in hfi1_release_user_pages() 101 atomic64_sub(npages, &mm->pinned_vm); in hfi1_release_user_pages()
|
| H A D | pin_system.c | 20 unsigned int npages; member 55 static u32 sdma_cache_evict(struct hfi1_user_sdma_pkt_q *pq, u32 npages) in sdma_cache_evict() argument 60 evict_data.target = npages; in sdma_cache_evict() 66 unsigned int start, unsigned int npages) in unpin_vector_pages() argument 68 hfi1_release_user_pages(mm, pages + start, npages, false); in unpin_vector_pages() 79 if (node->npages) { in free_system_node() 81 node->npages); in free_system_node() 82 atomic_sub(node->npages, &node->pq->n_locked); in free_system_node() 116 struct sdma_mmu_node *node, int npages) in pin_system_pages() argument 122 pages = kzalloc_objs(*pages, npages); in pin_system_pages() [all …]
|
| /linux/arch/sparc/kernel/ |
| H A D | iommu.c | 158 unsigned long npages) in alloc_npages() argument 162 entry = iommu_tbl_range_alloc(dev, &iommu->tbl, npages, NULL, in alloc_npages() 204 int npages, nid; in dma_4u_alloc_coherent() local 233 npages = size >> IO_PAGE_SHIFT; in dma_4u_alloc_coherent() 235 while (npages--) { in dma_4u_alloc_coherent() 251 unsigned long order, npages; in dma_4u_free_coherent() local 253 npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT; in dma_4u_free_coherent() 256 iommu_tbl_range_free(&iommu->tbl, dvma, npages, IOMMU_ERROR_CODE); in dma_4u_free_coherent() 270 unsigned long flags, npages, oaddr; in dma_4u_map_phys() local 292 npages = IO_PAGE_ALIGN(oaddr + sz) - (oaddr & IO_PAGE_MASK); in dma_4u_map_phys() [all …]
|
| H A D | pci_sun4v.c | 61 unsigned long npages; /* Number of pages in list. */ member 75 p->npages = 0; in iommu_batch_start() 92 unsigned long npages = p->npages; in iommu_batch_flush() local 101 while (npages != 0) { in iommu_batch_flush() 105 npages, in iommu_batch_flush() 113 npages, prot, __pa(pglist), in iommu_batch_flush() 118 index_count = HV_PCI_IOTSB_INDEX_COUNT(npages, entry), in iommu_batch_flush() 136 npages -= num; in iommu_batch_flush() 141 p->npages = 0; in iommu_batch_flush() 150 if (p->entry + p->npages == entry) in iommu_batch_new_entry() [all …]
|
| /linux/drivers/gpu/drm/i915/gem/selftests/ |
| H A D | mock_dmabuf.c | 22 err = sg_alloc_table(st, mock->npages, GFP_KERNEL); in mock_map_dma_buf() 27 for (i = 0; i < mock->npages; i++) { in mock_map_dma_buf() 59 for (i = 0; i < mock->npages; i++) in mock_dmabuf_release() 70 vaddr = vm_map_ram(mock->pages, mock->npages, 0); in mock_dmabuf_vmap() 82 vm_unmap_ram(map->vaddr, mock->npages); in mock_dmabuf_vunmap() 99 static struct dma_buf *mock_dmabuf(int npages) in mock_dmabuf() argument 106 mock = kmalloc_flex(*mock, pages, npages); in mock_dmabuf() 110 mock->npages = npages; in mock_dmabuf() 111 for (i = 0; i < npages; i++) { in mock_dmabuf() 118 exp_info.size = npages * PAGE_SIZE; in mock_dmabuf()
|
| /linux/drivers/iommu/iommufd/ |
| H A D | iova_bitmap.c | 48 unsigned long npages; member 168 unsigned long npages; in iova_bitmap_get() local 178 npages = DIV_ROUND_UP((bitmap->mapped_total_index - in iova_bitmap_get() 192 npages = min(npages + !!offset_in_page(addr), in iova_bitmap_get() 195 ret = pin_user_pages_fast((unsigned long)addr, npages, in iova_bitmap_get() 200 mapped->npages = (unsigned long)ret; in iova_bitmap_get() 223 if (mapped->npages) { in iova_bitmap_put() 224 unpin_user_pages(mapped->pages, mapped->npages); in iova_bitmap_put() 225 mapped->npages = 0; in iova_bitmap_put() 306 bytes = (bitmap->mapped.npages << PAGE_SHIFT) - bitmap->mapped.pgoff; in iova_bitmap_mapped_remaining() [all …]
|
| H A D | pages.c | 167 static void iopt_pages_add_npinned(struct iopt_pages *pages, size_t npages) in iopt_pages_add_npinned() argument 171 rc = check_add_overflow(pages->npinned, npages, &pages->npinned); in iopt_pages_add_npinned() 173 WARN_ON(rc || pages->npinned > pages->npages); in iopt_pages_add_npinned() 176 static void iopt_pages_sub_npinned(struct iopt_pages *pages, size_t npages) in iopt_pages_sub_npinned() argument 180 rc = check_sub_overflow(pages->npinned, npages, &pages->npinned); in iopt_pages_sub_npinned() 182 WARN_ON(rc || pages->npinned > pages->npages); in iopt_pages_sub_npinned() 190 unsigned long npages = last_index - start_index + 1; in iopt_pages_err_unpin() local 192 unpin_user_pages(page_list, npages); in iopt_pages_err_unpin() 193 iopt_pages_sub_npinned(pages, npages); in iopt_pages_err_unpin() 654 size_t npages) in batch_from_pages() argument [all …]
|
| /linux/drivers/fpga/ |
| H A D | dfl-afu-dma-region.c | 37 int npages = region->length >> PAGE_SHIFT; in afu_dma_pin_pages() local 41 ret = account_locked_vm(current->mm, npages, true); in afu_dma_pin_pages() 45 region->pages = kzalloc_objs(struct page *, npages); in afu_dma_pin_pages() 51 pinned = pin_user_pages_fast(region->user_addr, npages, FOLL_WRITE, in afu_dma_pin_pages() 56 } else if (pinned != npages) { in afu_dma_pin_pages() 70 account_locked_vm(current->mm, npages, false); in afu_dma_pin_pages() 85 long npages = region->length >> PAGE_SHIFT; in afu_dma_unpin_pages() local 88 unpin_user_pages(region->pages, npages); in afu_dma_unpin_pages() 90 account_locked_vm(current->mm, npages, false); in afu_dma_unpin_pages() 92 dev_dbg(dev, "%ld pages unpinned\n", npages); in afu_dma_unpin_pages() [all …]
|
| /linux/drivers/infiniband/hw/mthca/ |
| H A D | mthca_memfree.c | 69 dma_unmap_sg(&dev->pdev->dev, chunk->mem, chunk->npages, in mthca_free_icm_pages() 72 for (i = 0; i < chunk->npages; ++i) in mthca_free_icm_pages() 81 for (i = 0; i < chunk->npages; ++i) { in mthca_free_icm_coherent() 137 struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, in mthca_alloc_icm() argument 157 while (npages > 0) { in mthca_alloc_icm() 165 chunk->npages = 0; in mthca_alloc_icm() 170 while (1 << cur_order > npages) in mthca_alloc_icm() 175 &chunk->mem[chunk->npages], in mthca_alloc_icm() 178 ret = mthca_alloc_icm_pages(&chunk->mem[chunk->npages], in mthca_alloc_icm() 182 ++chunk->npages; in mthca_alloc_icm() [all …]
|
| /linux/arch/x86/mm/ |
| H A D | cpu_entry_area.c | 108 unsigned int npages; in percpu_setup_debug_store() local 115 npages = sizeof(struct debug_store) / PAGE_SIZE; in percpu_setup_debug_store() 117 cea_map_percpu_pages(cea, &per_cpu(cpu_debug_store, cpu), npages, in percpu_setup_debug_store() 125 npages = sizeof(struct debug_store_buffers) / PAGE_SIZE; in percpu_setup_debug_store() 126 for (; npages; npages--, cea += PAGE_SIZE) in percpu_setup_debug_store() 134 npages = sizeof(estacks->name## _stack) / PAGE_SIZE; \ 136 estacks->name## _stack, npages, PAGE_KERNEL); \ 143 unsigned int npages; in percpu_setup_exception_stacks() local
|
| H A D | mem_encrypt_amd.c | 60 unsigned long npages = PAGE_ALIGN(sz) >> PAGE_SHIFT; in snp_memcpy() local 67 early_snp_set_memory_shared((unsigned long)__va(paddr), paddr, npages); in snp_memcpy() 72 early_snp_set_memory_private((unsigned long)__va(paddr), paddr, npages); in snp_memcpy() 286 static int amd_enc_status_change_prepare(unsigned long vaddr, int npages, bool enc) in amd_enc_status_change_prepare() argument 293 snp_set_memory_shared(vaddr, npages); in amd_enc_status_change_prepare() 299 static int amd_enc_status_change_finish(unsigned long vaddr, int npages, bool enc) in amd_enc_status_change_finish() argument 306 snp_set_memory_private(vaddr, npages); in amd_enc_status_change_finish() 309 enc_dec_hypercall(vaddr, npages << PAGE_SHIFT, enc); in amd_enc_status_change_finish() 545 unsigned long vaddr, vaddr_end, npages; in mem_encrypt_free_decrypted_mem() local 550 npages = (vaddr_end - vaddr) >> PAGE_SHIFT; in mem_encrypt_free_decrypted_mem() [all …]
|
| /linux/tools/testing/selftests/kvm/ |
| H A D | memslot_perf_test.c | 89 u64 npages; member 198 TEST_ASSERT(gpa < MEM_GPA + data->npages * guest_page_size, in vm_gpa2hva() 211 slotpages = data->npages - slot * data->pages_per_slot; in vm_gpa2hva() 269 mempages = data->npages; in get_max_slots() 302 data->npages = mempages; in prepare_vm() 303 TEST_ASSERT(data->npages > 1, "Can't test without any memory"); in prepare_vm() 305 data->pages_per_slot = data->npages / data->nslots; in prepare_vm() 306 rempages = data->npages % data->nslots; in prepare_vm() 321 u64 npages; in prepare_vm() 323 npages in prepare_vm() 320 u64 npages; prepare_vm() local 334 u64 npages; prepare_vm() local 645 u64 npages; test_memslot_do_unmap() local [all...] |
| /linux/fs/netfs/ |
| H A D | iterator.c | 44 unsigned int npages = 0; in netfs_extract_user_iter() local 66 while (count && npages < max_pages) { in netfs_extract_user_iter() 68 max_pages - npages, extraction_flags, in netfs_extract_user_iter() 83 if (WARN(cur_npages > max_pages - npages, in netfs_extract_user_iter() 85 __func__, npages + cur_npages, max_pages)) { in netfs_extract_user_iter() 95 bvec_set_page(bv + npages + i, *pages++, len - offset, offset); in netfs_extract_user_iter() 100 npages += cur_npages; in netfs_extract_user_iter() 108 if (ret < 0 && (ret == -ENOMEM || npages == 0)) { in netfs_extract_user_iter() 109 for (i = 0; i < npages; i++) in netfs_extract_user_iter() 115 iov_iter_bvec(new, orig->data_source, bv, npages, orig_len - count); in netfs_extract_user_iter() [all …]
|
| /linux/drivers/net/ethernet/mellanox/mlx4/ |
| H A D | icm.c | 60 dma_unmap_sg(&dev->persist->pdev->dev, chunk->sg, chunk->npages, in mlx4_free_icm_pages() 63 for (i = 0; i < chunk->npages; ++i) in mlx4_free_icm_pages() 72 for (i = 0; i < chunk->npages; ++i) in mlx4_free_icm_coherent() 132 struct mlx4_icm *mlx4_alloc_icm(struct mlx4_dev *dev, int npages, in mlx4_alloc_icm() argument 159 while (npages > 0) { in mlx4_alloc_icm() 178 while (1 << cur_order > npages) in mlx4_alloc_icm() 187 &chunk->buf[chunk->npages], in mlx4_alloc_icm() 190 ret = mlx4_alloc_icm_pages(&chunk->sg[chunk->npages], in mlx4_alloc_icm() 201 ++chunk->npages; in mlx4_alloc_icm() 205 else if (chunk->npages == MLX4_ICM_CHUNK_LEN) { in mlx4_alloc_icm() [all …]
|
| /linux/drivers/gpu/drm/i915/gem/ |
| H A D | i915_gem_internal.c | 37 unsigned int npages; /* restricted by sg_alloc_table */ in i915_gem_object_get_pages_internal() local 42 if (overflows_type(obj->base.size >> PAGE_SHIFT, npages)) in i915_gem_object_get_pages_internal() 45 npages = obj->base.size >> PAGE_SHIFT; in i915_gem_object_get_pages_internal() 61 if (sg_alloc_table(st, npages, GFP_KERNEL)) { in i915_gem_object_get_pages_internal() 70 int order = min(fls(npages) - 1, max_order); in i915_gem_object_get_pages_internal() 88 npages -= 1 << order; in i915_gem_object_get_pages_internal() 89 if (!npages) { in i915_gem_object_get_pages_internal()
|
| /linux/arch/powerpc/sysdev/ |
| H A D | dart_iommu.c | 172 long npages, unsigned long uaddr, in dart_build() argument 180 DBG("dart: build at: %lx, %lx, addr: %x\n", index, npages, uaddr); in dart_build() 187 l = npages; in dart_build() 195 dart_cache_sync(orig_dp, npages); in dart_build() 199 while (npages--) in dart_build() 208 static void dart_free(struct iommu_table *tbl, long index, long npages) in dart_free() argument 211 long orig_npages = npages; in dart_free() 218 DBG("dart: free at: %lx, %lx\n", index, npages); in dart_free() 222 while (npages--) in dart_free()
|
| /linux/drivers/gpu/drm/etnaviv/ |
| H A D | etnaviv_gem_prime.c | 20 unsigned int npages = obj->size >> PAGE_SHIFT; in etnaviv_gem_prime_get_sg_table() local 25 return drm_prime_pages_to_sg(obj->dev, etnaviv_obj->pages, npages); in etnaviv_gem_prime_get_sg_table() 117 int ret, npages; in etnaviv_gem_prime_import_sg_table() local 126 npages = size / PAGE_SIZE; in etnaviv_gem_prime_import_sg_table() 129 etnaviv_obj->pages = kvmalloc_objs(struct page *, npages); in etnaviv_gem_prime_import_sg_table() 135 ret = drm_prime_sg_to_page_array(sgt, etnaviv_obj->pages, npages); in etnaviv_gem_prime_import_sg_table()
|
| /linux/drivers/gpu/drm/tests/ |
| H A D | drm_panic_test.c | 122 int fb_size, p, i, npages; in drm_test_panic_screen_user_page() local 128 npages = DIV_ROUND_UP(fb_size, PAGE_SIZE); in drm_test_panic_screen_user_page() 130 pages = kmalloc_objs(struct page *, npages); in drm_test_panic_screen_user_page() 133 for (p = 0; p < npages; p++) { in drm_test_panic_screen_user_page() 136 npages = p - 1; in drm_test_panic_screen_user_page() 151 for (p = 0; p < npages; p++) { in drm_test_panic_screen_user_page() 152 int bytes_in_page = (p == npages - 1) ? fb_size - p * PAGE_SIZE : PAGE_SIZE; in drm_test_panic_screen_user_page() 162 for (p = 0; p < npages; p++) in drm_test_panic_screen_user_page()
|
| /linux/drivers/crypto/ccp/ |
| H A D | sev-dev-tio.c | 316 unsigned int i, npages = 0; in sla_buffer_map() local 326 npages = i; in sla_buffer_map() 330 if (WARN_ON_ONCE(!npages)) in sla_buffer_map() 333 struct page **pp = kmalloc_objs(pp[0], npages); in sla_buffer_map() 338 for (i = 0; i < npages; ++i) in sla_buffer_map() 341 buf = vm_map_ram(pp, npages, 0); in sla_buffer_map() 359 unsigned int i, npages = 0; in sla_buffer_unmap() local 363 npages = i; in sla_buffer_unmap() 367 if (!npages) in sla_buffer_unmap() 370 vm_unmap_ram(buf, npages); in sla_buffer_unmap() [all …]
|
| /linux/arch/alpha/kernel/ |
| H A D | pci_iommu.c | 234 long npages, dma_ofs, i; in pci_map_single_1() local 274 npages = iommu_num_pages(paddr, size, PAGE_SIZE); in pci_map_single_1() 279 dma_ofs = iommu_arena_alloc(dev, arena, npages, align); in pci_map_single_1() 287 for (i = 0; i < npages; ++i, paddr += PAGE_SIZE) in pci_map_single_1() 294 &paddr, size, npages, ret, __builtin_return_address(0)); in pci_map_single_1() 351 long dma_ofs, npages; in alpha_pci_unmap_phys() local 382 npages = iommu_num_pages(dma_addr, size, PAGE_SIZE); in alpha_pci_unmap_phys() 386 iommu_arena_free(arena, dma_ofs, npages); in alpha_pci_unmap_phys() 397 dma_addr, size, npages, __builtin_return_address(0)); in alpha_pci_unmap_phys() 533 long npages, dma_ofs, i; in sg_fill() local [all …]
|
| /linux/arch/powerpc/platforms/pasemi/ |
| H A D | iommu.c | 78 long npages, unsigned long uaddr, in iobmap_build() argument 86 pr_debug("iobmap: build at: %lx, %lx, addr: %lx\n", index, npages, uaddr); in iobmap_build() 92 while (npages--) { in iobmap_build() 107 long npages) in iobmap_free() argument 112 pr_debug("iobmap: free at: %lx, %lx\n", index, npages); in iobmap_free() 118 while (npages--) { in iobmap_free()
|
| /linux/fs/nfs/ |
| H A D | nfs3acl.c | 201 unsigned int npages = 1 + ((args.len - 1) >> PAGE_SHIFT); in __nfs3_proc_setacls() local 205 args.pages[args.npages] = alloc_page(GFP_KERNEL); in __nfs3_proc_setacls() 206 if (args.pages[args.npages] == NULL) in __nfs3_proc_setacls() 208 args.npages++; in __nfs3_proc_setacls() 209 } while (args.npages < npages); in __nfs3_proc_setacls() 240 while (args.npages != 0) { in __nfs3_proc_setacls() 241 args.npages--; in __nfs3_proc_setacls() 242 __free_page(args.pages[args.npages]); in __nfs3_proc_setacls()
|