/linux/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/ |
H A D | mlx5hws_buddy.c | 7 static int hws_buddy_init(struct mlx5hws_buddy_mem *buddy, u32 max_order) in hws_buddy_init() argument 11 buddy->max_order = max_order; in hws_buddy_init() 13 buddy->bitmap = kcalloc(buddy->max_order + 1, in hws_buddy_init() 14 sizeof(*buddy->bitmap), in hws_buddy_init() 16 if (!buddy->bitmap) in hws_buddy_init() 19 buddy->num_free = kcalloc(buddy->max_order + 1, in hws_buddy_init() 20 sizeof(*buddy->num_free), in hws_buddy_init() 22 if (!buddy->num_free) { in hws_buddy_init() 27 for (i = 0; i <= (int)buddy->max_order; ++i) { in hws_buddy_init() 28 s = 1 << (buddy->max_order - i); in hws_buddy_init() [all …]
|
H A D | mlx5hws_pool.c | 130 struct mlx5hws_buddy_mem *buddy; in hws_pool_buddy_db_put_chunk() local 132 buddy = pool->db.buddy_manager->buddies[chunk->resource_idx]; in hws_pool_buddy_db_put_chunk() 133 if (!buddy) { in hws_pool_buddy_db_put_chunk() 138 mlx5hws_buddy_free_mem(buddy, chunk->offset, chunk->order); in hws_pool_buddy_db_put_chunk() 145 static struct mlx5hws_buddy_mem *buddy; in hws_pool_buddy_get_next_buddy() local 148 buddy = pool->db.buddy_manager->buddies[idx]; in hws_pool_buddy_get_next_buddy() 149 if (buddy) in hws_pool_buddy_get_next_buddy() 150 return buddy; in hws_pool_buddy_get_next_buddy() 154 buddy = mlx5hws_buddy_create(new_buddy_size); in hws_pool_buddy_get_next_buddy() 155 if (!buddy) { in hws_pool_buddy_get_next_buddy() [all …]
|
H A D | mlx5hws_buddy.h | 15 void mlx5hws_buddy_cleanup(struct mlx5hws_buddy_mem *buddy); 17 int mlx5hws_buddy_alloc_mem(struct mlx5hws_buddy_mem *buddy, u32 order); 19 void mlx5hws_buddy_free_mem(struct mlx5hws_buddy_mem *buddy, u32 seg, u32 order);
|
/linux/drivers/net/ethernet/mellanox/mlx5/core/steering/ |
H A D | dr_buddy.c | 10 int mlx5dr_buddy_init(struct mlx5dr_icm_buddy_mem *buddy, in mlx5dr_buddy_init() argument 15 buddy->max_order = max_order; in mlx5dr_buddy_init() 17 INIT_LIST_HEAD(&buddy->list_node); in mlx5dr_buddy_init() 19 buddy->bitmap = kcalloc(buddy->max_order + 1, in mlx5dr_buddy_init() 20 sizeof(*buddy->bitmap), in mlx5dr_buddy_init() 22 buddy->num_free = kcalloc(buddy->max_order + 1, in mlx5dr_buddy_init() 23 sizeof(*buddy->num_free), in mlx5dr_buddy_init() 26 if (!buddy->bitmap || !buddy->num_free) in mlx5dr_buddy_init() 31 for (i = 0; i <= buddy->max_order; ++i) { in mlx5dr_buddy_init() 32 unsigned int size = 1 << (buddy->max_order - i); in mlx5dr_buddy_init() [all …]
|
H A D | dr_icm_pool.c | 199 static int dr_icm_buddy_get_ste_size(struct mlx5dr_icm_buddy_mem *buddy) in dr_icm_buddy_get_ste_size() argument 212 struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem; in dr_icm_chunk_ste_init() local 213 int ste_size = dr_icm_buddy_get_ste_size(buddy); in dr_icm_chunk_ste_init() 216 chunk->ste_arr = &buddy->ste_arr[index]; in dr_icm_chunk_ste_init() 217 chunk->miss_list = &buddy->miss_list[index]; in dr_icm_chunk_ste_init() 218 chunk->hw_ste_arr = buddy->hw_ste_arr + index * ste_size; in dr_icm_chunk_ste_init() 225 static int dr_icm_buddy_init_ste_cache(struct mlx5dr_icm_buddy_mem *buddy) in dr_icm_buddy_init_ste_cache() argument 228 mlx5dr_icm_pool_chunk_size_to_entries(buddy->pool->max_log_chunk_sz); in dr_icm_buddy_init_ste_cache() 230 buddy->ste_arr = kvcalloc(num_of_entries, in dr_icm_buddy_init_ste_cache() 232 if (!buddy->ste_arr) in dr_icm_buddy_init_ste_cache() [all …]
|
H A D | mlx5dr.h | 187 int mlx5dr_buddy_init(struct mlx5dr_icm_buddy_mem *buddy, 189 void mlx5dr_buddy_cleanup(struct mlx5dr_icm_buddy_mem *buddy); 190 int mlx5dr_buddy_alloc_mem(struct mlx5dr_icm_buddy_mem *buddy, 193 void mlx5dr_buddy_free_mem(struct mlx5dr_icm_buddy_mem *buddy,
|
/linux/drivers/infiniband/hw/mthca/ |
H A D | mthca_mr.c | 42 struct mthca_buddy *buddy; member 84 static u32 mthca_buddy_alloc(struct mthca_buddy *buddy, int order) in mthca_buddy_alloc() argument 90 spin_lock(&buddy->lock); in mthca_buddy_alloc() 92 for (o = order; o <= buddy->max_order; ++o) in mthca_buddy_alloc() 93 if (buddy->num_free[o]) { in mthca_buddy_alloc() 94 m = 1 << (buddy->max_order - o); in mthca_buddy_alloc() 95 seg = find_first_bit(buddy->bits[o], m); in mthca_buddy_alloc() 100 spin_unlock(&buddy->lock); in mthca_buddy_alloc() 104 __clear_bit(seg, buddy->bits[o]); in mthca_buddy_alloc() 105 --buddy->num_free[o]; in mthca_buddy_alloc() [all …]
|
/linux/arch/arm64/kvm/hyp/nvhe/ |
H A D | page_alloc.c | 56 struct hyp_page *buddy = __find_buddy_nocheck(pool, p, order); in __find_buddy_avail() local 58 if (!buddy || buddy->order != order || buddy->refcount) in __find_buddy_avail() 61 return buddy; in __find_buddy_avail() 98 struct hyp_page *buddy; in __hyp_attach_page() local 114 buddy = __find_buddy_avail(pool, p, order); in __hyp_attach_page() 115 if (!buddy) in __hyp_attach_page() 119 page_remove_from_list(buddy); in __hyp_attach_page() 120 buddy->order = HYP_NO_ORDER; in __hyp_attach_page() 121 p = min(p, buddy); in __hyp_attach_page() 134 struct hyp_page *buddy; in __hyp_extract_page() local [all …]
|
/linux/drivers/net/ethernet/mellanox/mlx4/ |
H A D | mr.c | 46 static u32 mlx4_buddy_alloc(struct mlx4_buddy *buddy, int order) in mlx4_buddy_alloc() argument 52 spin_lock(&buddy->lock); in mlx4_buddy_alloc() 54 for (o = order; o <= buddy->max_order; ++o) in mlx4_buddy_alloc() 55 if (buddy->num_free[o]) { in mlx4_buddy_alloc() 56 m = 1 << (buddy->max_order - o); in mlx4_buddy_alloc() 57 seg = find_first_bit(buddy->bits[o], m); in mlx4_buddy_alloc() 62 spin_unlock(&buddy->lock); in mlx4_buddy_alloc() 66 clear_bit(seg, buddy->bits[o]); in mlx4_buddy_alloc() 67 --buddy->num_free[o]; in mlx4_buddy_alloc() 72 set_bit(seg ^ 1, buddy->bits[o]); in mlx4_buddy_alloc() [all …]
|
/linux/mm/ |
H A D | zbud.c | 10 * to what its name may suggest, zbud is not a buddy allocator, but rather an 19 * single memory page called a "zbud page". The first buddy is "left 20 * justified" at the beginning of the zbud page, and the last buddy is "right 22 * buddy is freed, the freed buddy space, coalesced with whatever slack space 81 * @unbuddied: array of lists tracking zbud pages that only contain one buddy; 107 * @buddy: links the zbud page into the unbuddied/buddied lists in the pool 108 * @first_chunks: the size of the first buddy in chunks, 0 if free 109 * @last_chunks: the size of the last buddy in chunks, 0 if free 112 struct list_head buddy; member 121 enum buddy { global() enum [all...] |
H A D | z3fold.c | 72 enum buddy { enum 94 * @buddy: links the z3fold page into the relevant list in the 99 * @slots: pointer to the structure holding buddy slots 102 * @first_chunks: the size of the first buddy in chunks, 0 if free 103 * @middle_chunks: the size of the middle buddy in chunks, 0 if free 104 * @last_chunks: the size of the last buddy in chunks, 0 if free 109 struct list_head buddy; member 344 INIT_LIST_HEAD(&zhdr->buddy); in init_z3fold_page() 361 static inline int __idx(struct z3fold_header *zhdr, enum buddy bud) in __idx() 367 * Encodes the handle of a particular buddy withi 1180 enum buddy buddy; z3fold_map() local 1224 enum buddy buddy; z3fold_unmap() local [all...] |
H A D | internal.h | 488 * This function returns the order of a free page in the buddy system. In 515 * This function checks whether a page is free && is the buddy in page_is_buddy() 516 * we can coalesce a page and its buddy if in page_is_buddy() 517 * (a) the buddy is not in a hole (check before calling!) && in page_is_buddy() 518 * (b) the buddy is in the buddy system && in page_is_buddy() 519 * (c) a page and its buddy have the same order && in page_is_buddy() 520 * (d) a page and its buddy are in the same zone. in page_is_buddy() 522 * For recording whether a page is in the buddy system, we set PageBuddy. in page_is_buddy() 527 static inline bool page_is_buddy(struct page *page, struct page *buddy, in page_is_buddy() 510 page_is_buddy(struct page * page,struct page * buddy,unsigned int order) page_is_buddy() argument 572 struct page *buddy; find_buddy_page_pfn() local [all...] |
H A D | page_isolation.c | 110 * The HWPoisoned page may be not in buddy system, and in has_unmovable_pages() 211 struct page *buddy; in unset_migratetype_isolate() 221 * it is possible that there is free buddy page. in unset_migratetype_isolate() 229 buddy = find_buddy_page_pfn(page, page_to_pfn(page), in unset_migratetype_isolate() 231 if (buddy && !is_migrate_isolate_page(buddy)) { in unset_migratetype_isolate() 212 struct page *buddy; unset_migratetype_isolate() local
|
H A D | page_alloc.c | 774 struct page *buddy; in __free_one_page() local 794 buddy = find_buddy_page_pfn(page, pfn, order, &buddy_pfn); in __free_one_page() 795 if (!buddy) in __free_one_page() 805 buddy_mt = get_pfnblock_migratetype(buddy, buddy_pfn); in __free_one_page() 817 if (page_is_guard(buddy)) in __free_one_page() 818 clear_page_guard(zone, buddy, order); in __free_one_page() 820 __del_page_from_free_list(buddy, zone, order, buddy_mt); in __free_one_page() 828 set_pageblock_migratetype(buddy, migratetype); in __free_one_page() 1775 struct page *buddy = pfn_to_page(pfn); in move_freepages_block_isolate() local 1776 int order = buddy_order(buddy); in move_freepages_block_isolate() [all …]
|
/linux/drivers/gpu/drm/ |
H A D | drm_buddy.c | 128 struct drm_buddy_block *buddy; in __drm_buddy_free() local 130 buddy = __get_buddy(block); in __drm_buddy_free() 132 if (!drm_buddy_block_is_free(buddy)) in __drm_buddy_free() 141 drm_buddy_block_is_clear(buddy)) in __drm_buddy_free() 148 list_del(&buddy->link); in __drm_buddy_free() 149 if (force_merge && drm_buddy_block_is_clear(buddy)) in __drm_buddy_free() 150 mm->clear_avail -= drm_buddy_block_size(mm, buddy); in __drm_buddy_free() 153 drm_block_free(mm, buddy); in __drm_buddy_free() 182 struct drm_buddy_block *buddy; in __force_merge() local 194 buddy = __get_buddy(block); in __force_merge() [all …]
|
/linux/fs/ext4/ |
H A D | mballoc-test.c | 604 static void mbt_generate_buddy(struct super_block *sb, void *buddy, in mbt_generate_buddy() argument 612 memset(buddy, 0xff, sb->s_blocksize); in mbt_generate_buddy() 618 bb_h = buddy + sbi->s_mb_offsets[1]; in mbt_generate_buddy() 639 bb = buddy + sbi->s_mb_offsets[order]; in mbt_generate_buddy() 640 bb_h = buddy + sbi->s_mb_offsets[order + 1]; in mbt_generate_buddy() 748 void *buddy, struct ext4_group_info *grp) in test_mb_mark_used_range() argument 769 memset(buddy, 0xff, sb->s_blocksize); in test_mb_mark_used_range() 772 ext4_mb_generate_buddy(sb, buddy, bitmap, 0, grp); in test_mb_mark_used_range() 774 KUNIT_ASSERT_EQ(test, memcmp(buddy, e4b->bd_buddy, sb->s_blocksize), in test_mb_mark_used_range() 783 void *bitmap, *buddy; in test_mb_mark_used() local [all …]
|
/linux/arch/mips/include/asm/ |
H A D | pgtable.h | 130 pte_t *buddy = ptep_buddy(ptep); local 135 if (pte_none(*buddy)) { 137 buddy->pte_low |= _PAGE_GLOBAL; 138 buddy->pte_high |= _PAGE_GLOBAL; 176 pte_t *buddy = ptep_buddy(ptep); local 182 cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL); 184 cmpxchg(&buddy->pte, 0, _PAGE_GLOBAL);
|
/linux/drivers/dma-buf/heaps/ |
H A D | Kconfig | 6 is backed by pages from the buddy allocator. If in doubt, say Y.
|
/linux/Documentation/gpu/rfc/ |
H A D | i915_gem_lmem.rst | 20 * Move i915 buddy allocator over to TTM
|
/linux/Documentation/trace/ |
H A D | events-kmem.rst | 56 the per-CPU allocator (high performance) or the buddy allocator. 58 If pages are allocated directly from the buddy allocator, the
|
/linux/include/trace/events/ |
H A D | mmflags.h |
|
/linux/Documentation/ABI/testing/ |
H A D | sysfs-fs-ext4 | 37 requests (as a power of 2) where the buddy cache is
|
/linux/Documentation/admin-guide/mm/ |
H A D | pagemap.rst | 98 A free memory block managed by the buddy system allocator. 99 The buddy system organizes free memory in blocks of various orders.
|
/linux/Documentation/admin-guide/sysctl/ |
H A D | vm.rst | 629 buddy allocator will be optimized (7 pages per 2MB HugeTLB page and 4095 pages 632 to the buddy allocator, the vmemmap pages representing that range needs to be 639 of allocation or freeing HugeTLB pages between the HugeTLB pool and the buddy 642 pool to the buddy allocator since the allocation of vmemmap pages could be 646 buddy allocator will not be optimized meaning the extra overhead at allocation 647 time from buddy allocator disappears, whereas already optimized HugeTLB pages
|
/linux/arch/x86/kvm/vmx/ |
H A D | vmx.h | 380 struct loaded_vmcs *buddy);
|