Home
last modified time | relevance | path

Searched refs:buddy (Results 1 – 25 of 43) sorted by relevance

12

/linux-6.12.1/drivers/net/ethernet/mellanox/mlx5/core/steering/hws/
Dmlx5hws_buddy.c7 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 …]
Dmlx5hws_pool.c130 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 …]
Dmlx5hws_buddy.h15 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-6.12.1/drivers/net/ethernet/mellanox/mlx5/core/steering/
Ddr_buddy.c10 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 …]
Ddr_icm_pool.c199 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 …]
Dmlx5dr.h187 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-6.12.1/drivers/infiniband/hw/mthca/
Dmthca_mr.c42 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-6.12.1/arch/arm64/kvm/hyp/nvhe/
Dpage_alloc.c56 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-6.12.1/drivers/net/ethernet/mellanox/mlx4/
Dmr.c46 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-6.12.1/mm/
Dzbud.c112 struct list_head buddy; member
121 enum buddy { enum
141 INIT_LIST_HEAD(&zhdr->buddy); in init_zbud_page()
155 static unsigned long encode_handle(struct zbud_header *zhdr, enum buddy bud) in encode_handle()
251 enum buddy bud; in zbud_alloc()
265 struct zbud_header, buddy); in zbud_alloc()
266 list_del(&zhdr->buddy); in zbud_alloc()
294 list_add(&zhdr->buddy, &pool->unbuddied[freechunks]); in zbud_alloc()
297 list_add(&zhdr->buddy, &pool->buddied); in zbud_alloc()
326 list_del(&zhdr->buddy); in zbud_free()
[all …]
Dz3fold.c72 enum buddy { enum
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()
373 enum buddy bud) in __encode_handle()
397 static unsigned long encode_handle(struct z3fold_header *zhdr, enum buddy bud) in encode_handle()
419 static enum buddy handle_to_buddy(unsigned long handle) in handle_to_buddy()
443 WARN_ON(!list_empty(&zhdr->buddy)); in __release_z3fold_page()
453 list_add(&zhdr->buddy, &pool->stale); in __release_z3fold_page()
475 list_del_init(&zhdr->buddy); in release_z3fold_page_locked_list()
[all …]
Dinternal.h572 static inline bool page_is_buddy(struct page *page, struct page *buddy, in page_is_buddy() argument
575 if (!page_is_guard(buddy) && !PageBuddy(buddy)) in page_is_buddy()
578 if (buddy_order(buddy) != order) in page_is_buddy()
585 if (page_zone_id(page) != page_zone_id(buddy)) in page_is_buddy()
588 VM_BUG_ON_PAGE(page_count(buddy) != 0, buddy); in page_is_buddy()
634 struct page *buddy; in find_buddy_page_pfn() local
636 buddy = page + (__buddy_pfn - pfn); in find_buddy_page_pfn()
640 if (page_is_buddy(page, buddy, order)) in find_buddy_page_pfn()
641 return buddy; in find_buddy_page_pfn()
Dpage_isolation.c211 struct page *buddy; in unset_migratetype_isolate() local
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()
Dpage_alloc.c779 struct page *buddy; in __free_one_page() local
799 buddy = find_buddy_page_pfn(page, pfn, order, &buddy_pfn); in __free_one_page()
800 if (!buddy) in __free_one_page()
810 buddy_mt = get_pfnblock_migratetype(buddy, buddy_pfn); in __free_one_page()
822 if (page_is_guard(buddy)) in __free_one_page()
823 clear_page_guard(zone, buddy, order); in __free_one_page()
825 __del_page_from_free_list(buddy, zone, order, buddy_mt); in __free_one_page()
833 set_pageblock_migratetype(buddy, migratetype); in __free_one_page()
1794 struct page *buddy = pfn_to_page(pfn); in move_freepages_block_isolate() local
1795 int order = buddy_order(buddy); in move_freepages_block_isolate()
[all …]
Ddebug.c57 DEF_PAGETYPE_NAME(buddy),
/linux-6.12.1/drivers/gpu/drm/
Ddrm_buddy.c128 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-6.12.1/fs/ext4/
Dmballoc-test.c604 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 …]
Dmballoc.c695 void *buddy; in __mb_check_buddy() local
702 buddy = mb_find_buddy(e4b, order, &max); in __mb_check_buddy()
703 MB_CHECK_ASSERT(buddy); in __mb_check_buddy()
706 MB_CHECK_ASSERT(buddy != buddy2); in __mb_check_buddy()
712 if (mb_test_bit(i, buddy)) { in __mb_check_buddy()
737 buddy = mb_find_buddy(e4b, 0, &max); in __mb_check_buddy()
739 if (!mb_test_bit(i, buddy)) { in __mb_check_buddy()
769 MB_CHECK_ASSERT(mb_test_bit(k + i, buddy)); in __mb_check_buddy()
786 void *buddy, ext4_grpblk_t first, ext4_grpblk_t len, in ext4_mb_mark_free_simple() argument
814 buddy + sbi->s_mb_offsets[min]); in ext4_mb_mark_free_simple()
[all …]
/linux-6.12.1/arch/mips/include/asm/
Dpgtable.h130 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-6.12.1/drivers/dma-buf/heaps/
DKconfig6 is backed by pages from the buddy allocator. If in doubt, say Y.
/linux-6.12.1/Documentation/mm/
Dvmemmap_dedup.rst30 to the buddy allocator for other uses.
133 7 pages to the buddy allocator.
160 When a HugeTLB is freed to the buddy system, we should allocate 7 pages for
175 Notice: The head vmemmap page is not freed to the buddy allocator and all
/linux-6.12.1/Documentation/gpu/rfc/
Di915_gem_lmem.rst20 * Move i915 buddy allocator over to TTM
/linux-6.12.1/Documentation/trace/
Devents-kmem.rst56 the per-CPU allocator (high performance) or the buddy allocator.
58 If pages are allocated directly from the buddy allocator, the
/linux-6.12.1/drivers/staging/rtl8723bs/core/
Drtw_pwrctrl.c91 struct adapter *buddy = adapter->pbuddy_adapter; in rtw_pwr_unassociated_idle() local
111 if (buddy) { in rtw_pwr_unassociated_idle()
112 struct mlme_priv *b_pmlmepriv = &(buddy->mlmepriv); in rtw_pwr_unassociated_idle()
/linux-6.12.1/fs/jfs/
Djfs_dmap.c2772 int budsz, buddy; in dbJoin() local
2802 buddy = leafno ^ budsz; in dbJoin()
2807 if (newval > leaf[buddy]) in dbJoin()
2811 if (newval < leaf[buddy]) in dbJoin()
2822 if (leafno < buddy) { in dbJoin()
2825 dbAdjTree(tp, buddy, NOFREE, is_ctl); in dbJoin()
2831 leafno = buddy; in dbJoin()

12