Lines Matching +full:address +full:- +full:aligned

1 // SPDX-License-Identifier: GPL-2.0
47 _1KB = 1ULL << 10, /* 1KB -> not page aligned */
84 unsigned long mid = low + (high - low) / 2; in get_sqrt()
91 high = mid - 1; in get_sqrt()
108 -1, 0); in is_remap_region_valid()
150 * Using /proc/self/maps, assert that the specified address range is contained
163 while (getline(&line, &len, maps_fp) != -1) { in is_range_mapped()
164 if (sscanf(line, "%lx-%lx", &first_val, &second_val) != 2) { in is_range_mapped()
179 * Returns the start address of the mapping on success, else returns
202 -1, 0); in get_source_mapping()
209 * Check that the address is aligned to the specified alignment. in get_source_mapping()
211 * specified are not considered valid. For instance, 1GB address is in get_source_mapping()
212 * 2MB-aligned, however it will not be considered valid for a in get_source_mapping()
216 if (((unsigned long long) src_addr & (c.src_alignment - 1)) || in get_source_mapping()
246 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in mremap_expand_merge()
286 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in mremap_expand_merge_offset()
317 * Consider the following range which is 2MB aligned and is
335 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in mremap_move_within_range()
344 src = (void *)((unsigned long)src & ~(SIZE_MB(2) - 1)); in mremap_move_within_range()
349 dest = src - SIZE_MB(2); in mremap_move_within_range()
374 if (munmap(ptr, size) == -1) in mremap_move_within_range()
383 /* Returns the time taken for the remap on success else returns -1. */
401 ret = -1; in remap_region()
408 /* Mask to zero out lower bits of address for alignment */ in remap_region()
409 align_mask = ~(c.dest_alignment - 1); in remap_region()
410 /* Offset of destination address from the end of the source region */ in remap_region()
411 offset = (c.overlapping) ? -c.dest_alignment : c.dest_alignment; in remap_region()
427 ret = -1; in remap_region()
434 dest_preamble_addr = mmap((void *) addr - c.dest_preamble_size, c.dest_preamble_size, in remap_region()
437 -1, 0); in remap_region()
441 ret = -1; in remap_region()
456 ret = -1; in remap_region()
463 * chunks, if memcmp() returns non-zero, only then perform an in remap_region()
481 ret = -1; in remap_region()
497 ret = -1; in remap_region()
523 ret = -1; in remap_region()
535 ret = -1; in remap_region()
543 ret = end_ns - start_ns; in remap_region()
546 * Since the destination address is specified using MREMAP_FIXED, subsequent in remap_region()
547 * mremap will unmap any previous mapping at the address range specified by in remap_region()
564 * the beginning of the mapping just because the aligned
565 * down address landed on a mapping that maybe does not exist.
570 char *test_name = "mremap move 1mb from start at 1MB+256KB aligned src"; in mremap_move_1mb_from_start()
574 /* Config to reuse get_source_mapping() to do an aligned mmap. */ in mremap_move_1mb_from_start()
597 * Unmap the beginning of dest so that the aligned address in mremap_move_1mb_from_start()
625 if (src && munmap(src, c.region_size) == -1) in mremap_move_1mb_from_start()
628 if (dest && munmap(dest, c.region_size) == -1) in mremap_move_1mb_from_start()
669 "Usage: %s [[-t <threshold_mb>] [-p <pattern_seed>]]\n" in usage()
670 "-t\t only validate threshold_mb of the remapped region\n" in usage()
674 "-p\t provide a seed to generate the random pattern for\n" in usage()
684 while ((opt = getopt(argc, argv, optstr)) != -1) { in parse_args()
694 return -1; in parse_args()
700 return -1; in parse_args()
714 /* hard-coded test configs */ in main()
752 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); in main()
768 "mremap - Source and Destination Regions Overlapping"); in main()
772 "mremap - Destination Address Misaligned (1KB-aligned)"); in main()
775 "mremap - Source Address Misaligned (1KB-aligned)"); in main()
777 /* Src addr PTE aligned */ in main()
780 "8KB mremap - Source PTE-aligned, Destination PTE-aligned"); in main()
782 /* Src addr 1MB aligned */ in main()
784 "2MB mremap - Source 1MB-aligned, Destination PTE-aligned"); in main()
786 "2MB mremap - Source 1MB-aligned, Destination 1MB-aligned"); in main()
788 /* Src addr PMD aligned */ in main()
790 "4MB mremap - Source PMD-aligned, Destination PTE-aligned"); in main()
792 "4MB mremap - Source PMD-aligned, Destination 1MB-aligned"); in main()
794 "4MB mremap - Source PMD-aligned, Destination PMD-aligned"); in main()
796 /* Src addr PUD aligned */ in main()
798 "2GB mremap - Source PUD-aligned, Destination PTE-aligned"); in main()
800 "2GB mremap - Source PUD-aligned, Destination 1MB-aligned"); in main()
802 "2GB mremap - Source PUD-aligned, Destination PMD-aligned"); in main()
804 "2GB mremap - Source PUD-aligned, Destination PUD-aligned"); in main()
806 /* Src and Dest addr 1MB aligned. 5MB mremap. */ in main()
808 "5MB mremap - Source 1MB-aligned, Destination 1MB-aligned"); in main()
810 /* Src and Dest addr 1MB aligned. 5MB mremap. */ in main()
812 "5MB mremap - Source 1MB-aligned, Dest 1MB-aligned with 40MB Preamble"); in main()
816 "1GB mremap - Source PTE-aligned, Destination PTE-aligned"); in main()
818 * mremap 1GB region - Page table level aligned time in main()
822 "1GB mremap - Source PMD-aligned, Destination PMD-aligned"); in main()
824 "1GB mremap - Source PUD-aligned, Destination PUD-aligned"); in main()