• Home
  • Raw
  • Download

Lines Matching refs:mm

46 static void __dump_block(struct kunit *test, struct drm_buddy *mm,  in __dump_block()  argument
52 drm_buddy_block_size(mm, block), !block->parent, buddy); in __dump_block()
55 static void dump_block(struct kunit *test, struct drm_buddy *mm, in dump_block() argument
60 __dump_block(test, mm, block, false); in dump_block()
64 __dump_block(test, mm, buddy, true); in dump_block()
67 static int check_block(struct kunit *test, struct drm_buddy *mm, in check_block() argument
84 block_size = drm_buddy_block_size(mm, block); in check_block()
87 if (block_size < mm->chunk_size) { in check_block()
98 if (!IS_ALIGNED(block_size, mm->chunk_size)) { in check_block()
103 if (!IS_ALIGNED(offset, mm->chunk_size)) { in check_block()
126 if (drm_buddy_block_size(mm, buddy) != block_size) { in check_block()
141 static int check_blocks(struct kunit *test, struct drm_buddy *mm, in check_blocks() argument
154 err = check_block(test, mm, block); in check_blocks()
167 prev_block_size = drm_buddy_block_size(mm, prev); in check_blocks()
179 total += drm_buddy_block_size(mm, block); in check_blocks()
194 dump_block(test, mm, prev); in check_blocks()
198 dump_block(test, mm, block); in check_blocks()
203 static int check_mm(struct kunit *test, struct drm_buddy *mm) in check_mm() argument
211 if (!mm->n_roots) { in check_mm()
216 if (mm->n_roots != hweight64(mm->size)) { in check_mm()
218 mm->n_roots, hweight64(mm->size)); in check_mm()
226 for (i = 0; i < mm->n_roots; ++i) { in check_mm()
230 root = mm->roots[i]; in check_mm()
237 err = check_block(test, mm, root); in check_mm()
247 if (order != mm->max_order) { in check_mm()
259 prev_block_size = drm_buddy_block_size(mm, prev); in check_mm()
268 block = list_first_entry_or_null(&mm->free_list[order], in check_mm()
279 total += drm_buddy_block_size(mm, root); in check_mm()
283 if (total != mm->size) { in check_mm()
285 mm->size, total); in check_mm()
293 dump_block(test, mm, prev); in check_mm()
298 dump_block(test, mm, root); in check_mm()
332 struct drm_buddy mm; in drm_test_buddy_alloc_pathological() local
345 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), in drm_test_buddy_alloc_pathological()
348 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); in drm_test_buddy_alloc_pathological()
355 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pathological()
360 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, in drm_test_buddy_alloc_pathological()
374 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pathological()
384 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pathological()
390 drm_buddy_free_list(&mm, &holes); in drm_test_buddy_alloc_pathological()
395 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pathological()
402 drm_buddy_free_list(&mm, &blocks); in drm_test_buddy_alloc_pathological()
403 drm_buddy_fini(&mm); in drm_test_buddy_alloc_pathological()
410 struct drm_buddy mm; in drm_test_buddy_alloc_smoke() local
419 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, chunk_size), in drm_test_buddy_alloc_smoke()
422 order = drm_random_order(mm.max_order + 1, &prng); in drm_test_buddy_alloc_smoke()
425 for (i = 0; i <= mm.max_order; ++i) { in drm_test_buddy_alloc_smoke()
434 KUNIT_ASSERT_FALSE_MSG(test, check_mm(test, &mm), in drm_test_buddy_alloc_smoke()
443 err = drm_buddy_alloc_blocks(&mm, start, mm_size, size, size, &tmp, flags); in drm_test_buddy_alloc_smoke()
468 total += drm_buddy_block_size(&mm, block); in drm_test_buddy_alloc_smoke()
474 } while (total < mm.size); in drm_test_buddy_alloc_smoke()
477 err = check_blocks(test, &mm, &blocks, total, false); in drm_test_buddy_alloc_smoke()
479 drm_buddy_free_list(&mm, &blocks); in drm_test_buddy_alloc_smoke()
482 KUNIT_EXPECT_FALSE_MSG(test, check_mm(test, &mm), in drm_test_buddy_alloc_smoke()
493 drm_buddy_fini(&mm); in drm_test_buddy_alloc_smoke()
502 struct drm_buddy mm; in drm_test_buddy_alloc_pessimistic() local
514 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), in drm_test_buddy_alloc_pessimistic()
517 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); in drm_test_buddy_alloc_pessimistic()
521 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pessimistic()
534 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pessimistic()
546 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pessimistic()
553 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
559 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
562 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pessimistic()
571 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
577 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_pessimistic()
586 drm_buddy_free_block(&mm, block); in drm_test_buddy_alloc_pessimistic()
587 drm_buddy_free_list(&mm, &blocks); in drm_test_buddy_alloc_pessimistic()
588 drm_buddy_fini(&mm); in drm_test_buddy_alloc_pessimistic()
597 struct drm_buddy mm; in drm_test_buddy_alloc_optimistic() local
609 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, mm_size, PAGE_SIZE), in drm_test_buddy_alloc_optimistic()
612 KUNIT_EXPECT_EQ(test, mm.max_order, max_order); in drm_test_buddy_alloc_optimistic()
616 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_optimistic()
629 KUNIT_ASSERT_TRUE_MSG(test, drm_buddy_alloc_blocks(&mm, start, mm_size, in drm_test_buddy_alloc_optimistic()
633 drm_buddy_free_list(&mm, &blocks); in drm_test_buddy_alloc_optimistic()
634 drm_buddy_fini(&mm); in drm_test_buddy_alloc_optimistic()
642 struct drm_buddy mm; in drm_test_buddy_alloc_range() local
647 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_init(&mm, size, chunk_size), in drm_test_buddy_alloc_range()
650 KUNIT_ASSERT_FALSE_MSG(test, check_mm(test, &mm), in drm_test_buddy_alloc_range()
653 rem = mm.size; in drm_test_buddy_alloc_range()
660 size = min(page_num * mm.chunk_size, rem); in drm_test_buddy_alloc_range()
663 KUNIT_ASSERT_FALSE_MSG(test, drm_buddy_alloc_blocks(&mm, offset, end, in drm_test_buddy_alloc_range()
664 size, mm.chunk_size, in drm_test_buddy_alloc_range()
675 KUNIT_ASSERT_FALSE(test, check_blocks(test, &mm, &tmp, size, true)); in drm_test_buddy_alloc_range()
688 drm_buddy_free_list(&mm, &blocks); in drm_test_buddy_alloc_range()
690 KUNIT_EXPECT_FALSE_MSG(test, check_mm(test, &mm), "post-mm check failed\n"); in drm_test_buddy_alloc_range()
692 drm_buddy_fini(&mm); in drm_test_buddy_alloc_range()
701 struct drm_buddy mm; in drm_test_buddy_alloc_limit() local
703 KUNIT_EXPECT_FALSE(test, drm_buddy_init(&mm, size, PAGE_SIZE)); in drm_test_buddy_alloc_limit()
705 KUNIT_EXPECT_EQ_MSG(test, mm.max_order, DRM_BUDDY_MAX_ORDER, in drm_test_buddy_alloc_limit()
706 "mm.max_order(%d) != %d\n", mm.max_order, in drm_test_buddy_alloc_limit()
709 size = mm.chunk_size << mm.max_order; in drm_test_buddy_alloc_limit()
710 KUNIT_EXPECT_FALSE(test, drm_buddy_alloc_blocks(&mm, start, size, size, in drm_test_buddy_alloc_limit()
716 KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_order(block), mm.max_order, in drm_test_buddy_alloc_limit()
718 drm_buddy_block_order(block), mm.max_order); in drm_test_buddy_alloc_limit()
720 KUNIT_EXPECT_EQ_MSG(test, drm_buddy_block_size(&mm, block), in drm_test_buddy_alloc_limit()
721 BIT_ULL(mm.max_order) * PAGE_SIZE, in drm_test_buddy_alloc_limit()
723 drm_buddy_block_size(&mm, block), in drm_test_buddy_alloc_limit()
724 BIT_ULL(mm.max_order) * PAGE_SIZE); in drm_test_buddy_alloc_limit()
726 drm_buddy_free_list(&mm, &allocated); in drm_test_buddy_alloc_limit()
727 drm_buddy_fini(&mm); in drm_test_buddy_alloc_limit()