/kernel/linux/linux-6.6/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 in mlx5dr_buddy_init() 59 mlx5dr_buddy_cleanup(struct mlx5dr_icm_buddy_mem *buddy) mlx5dr_buddy_cleanup() argument 72 dr_buddy_find_free_seg(struct mlx5dr_icm_buddy_mem *buddy, unsigned int start_order, unsigned int *segment, unsigned int *order) dr_buddy_find_free_seg() argument 119 mlx5dr_buddy_alloc_mem(struct mlx5dr_icm_buddy_mem *buddy, unsigned int order, unsigned int *segment) mlx5dr_buddy_alloc_mem() argument 150 mlx5dr_buddy_free_mem(struct mlx5dr_icm_buddy_mem *buddy, unsigned int seg, unsigned int order) mlx5dr_buddy_free_mem() argument [all...] |
H A D | dr_icm_pool.c | 24 struct mutex mutex; /* protect the ICM pool and ICM buddy */ 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 in dr_icm_buddy_init_ste_cache() 256 dr_icm_buddy_cleanup_ste_cache(struct mlx5dr_icm_buddy_mem *buddy) dr_icm_buddy_cleanup_ste_cache() argument 265 struct mlx5dr_icm_buddy_mem *buddy; dr_icm_buddy_create() local 304 dr_icm_buddy_destroy(struct mlx5dr_icm_buddy_mem *buddy) dr_icm_buddy_destroy() argument 367 struct mlx5dr_icm_buddy_mem *buddy, *tmp_buddy; dr_icm_pool_sync_all_buddy_pools() local 386 dr_icm_handle_buddies_get_mem(struct mlx5dr_icm_pool *pool, enum mlx5dr_icm_chunk_size chunk_size, struct mlx5dr_icm_buddy_mem **buddy, unsigned int *seg) dr_icm_handle_buddies_get_mem() argument 439 struct mlx5dr_icm_buddy_mem *buddy; mlx5dr_icm_alloc_chunk() local 469 struct mlx5dr_icm_buddy_mem *buddy = chunk->buddy_mem; mlx5dr_icm_free_chunk() local 566 struct mlx5dr_icm_buddy_mem *buddy, *tmp_buddy; mlx5dr_icm_pool_destroy() local [all...] |
H A D | mlx5dr.h | 171 /* buddy functions & structure */ 192 int mlx5dr_buddy_init(struct mlx5dr_icm_buddy_mem *buddy, 194 void mlx5dr_buddy_cleanup(struct mlx5dr_icm_buddy_mem *buddy); 195 int mlx5dr_buddy_alloc_mem(struct mlx5dr_icm_buddy_mem *buddy, 198 void mlx5dr_buddy_free_mem(struct mlx5dr_icm_buddy_mem *buddy,
|
/kernel/linux/linux-5.10/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 in mthca_buddy_alloc() 121 mthca_buddy_free(struct mthca_buddy *buddy, u32 seg, int order) mthca_buddy_free() argument 140 mthca_buddy_init(struct mthca_buddy *buddy, int max_order) mthca_buddy_init() argument 179 mthca_buddy_cleanup(struct mthca_buddy *buddy) mthca_buddy_cleanup() argument 190 mthca_alloc_mtt_range(struct mthca_dev *dev, int order, struct mthca_buddy *buddy) mthca_alloc_mtt_range() argument 208 __mthca_alloc_mtt(struct mthca_dev *dev, int size, struct mthca_buddy *buddy) __mthca_alloc_mtt() argument [all...] |
/kernel/linux/linux-6.6/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 in mthca_buddy_alloc() 121 mthca_buddy_free(struct mthca_buddy *buddy, u32 seg, int order) mthca_buddy_free() argument 140 mthca_buddy_init(struct mthca_buddy *buddy, int max_order) mthca_buddy_init() argument 177 mthca_buddy_cleanup(struct mthca_buddy *buddy) mthca_buddy_cleanup() argument 188 mthca_alloc_mtt_range(struct mthca_dev *dev, int order, struct mthca_buddy *buddy) mthca_alloc_mtt_range() argument 206 __mthca_alloc_mtt(struct mthca_dev *dev, int size, struct mthca_buddy *buddy) __mthca_alloc_mtt() argument [all...] |
/kernel/linux/linux-5.10/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 in mlx4_buddy_alloc() 83 mlx4_buddy_free(struct mlx4_buddy *buddy, u32 seg, int order) mlx4_buddy_free() argument 102 mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) mlx4_buddy_init() argument 139 mlx4_buddy_cleanup(struct mlx4_buddy *buddy) mlx4_buddy_cleanup() argument [all...] |
/kernel/linux/linux-6.6/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 in mlx4_buddy_alloc() 83 mlx4_buddy_free(struct mlx4_buddy *buddy, u32 seg, int order) mlx4_buddy_free() argument 102 mlx4_buddy_init(struct mlx4_buddy *buddy, int max_order) mlx4_buddy_init() argument 139 mlx4_buddy_cleanup(struct mlx4_buddy *buddy) mlx4_buddy_cleanup() argument [all...] |
/kernel/linux/linux-6.6/arch/arm64/kvm/hyp/nvhe/ |
H A D | page_alloc.c | 13 * Index the hyp_vmemmap to find a potential buddy page, but make no assumption 16 * Example buddy-tree for a 4-pages physically contiguous pool: 51 /* Find a buddy page currently available for allocation */ 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 in __hyp_attach_page() 134 struct hyp_page *buddy; __hyp_extract_page() local [all...] |
/kernel/linux/linux-6.6/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 1179 enum buddy buddy; z3fold_map() local 1223 enum buddy buddy; z3fold_unmap() local [all...] |
H A D | internal.h | 404 * This function returns the order of a free page in the buddy system. In 431 * This function checks whether a page is free && is the buddy 432 * we can coalesce a page and its buddy if 433 * (a) the buddy is not in a hole (check before calling!) && 434 * (b) the buddy is in the buddy system && 435 * (c) a page and its buddy have the same order && 436 * (d) a page and its buddy are in the same zone. 438 * For recording whether a page is in the buddy system, we set PageBuddy. 443 static inline bool page_is_buddy(struct page *page, struct page *buddy, in page_is_buddy() argument 505 struct page *buddy; find_buddy_page_pfn() local [all...] |
/kernel/linux/linux-5.10/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 80 * @unbuddied: array of lists tracking zbud pages that only contain one buddy; 86 * added buddy. 110 * @buddy: links the zbud page into the unbuddied/buddied lists in the pool 112 * @first_chunks: the size of the first buddy in chunks, 0 if free 113 * @last_chunks: the size of the last buddy i 116 struct list_head buddy; global() member 225 enum buddy { global() enum [all...] |
H A D | z3fold.c | 79 enum buddy { enum 101 * @buddy: links the z3fold page into the relevant list in the 106 * @slots: pointer to the structure holding buddy slots 109 * @first_chunks: the size of the first buddy in chunks, 0 if free 110 * @middle_chunks: the size of the middle buddy in chunks, 0 if free 111 * @last_chunks: the size of the last buddy in chunks, 0 if free 116 struct list_head buddy; member 141 * added buddy. 428 INIT_LIST_HEAD(&zhdr->buddy); in init_z3fold_page() 446 static inline int __idx(struct z3fold_header *zhdr, enum buddy bu 1507 enum buddy buddy; z3fold_map() local 1551 enum buddy buddy; z3fold_unmap() local [all...] |
H A D | page_isolation.c | 75 struct page *buddy; in unset_migratetype_isolate() local 85 * it is possible that there is free buddy page. in unset_migratetype_isolate() 95 buddy = page + (buddy_pfn - pfn); in unset_migratetype_isolate() 98 !is_migrate_isolate_page(buddy)) { in unset_migratetype_isolate()
|
/kernel/linux/linux-5.10/drivers/gpu/drm/i915/selftests/ |
H A D | i915_buddy.c | 13 bool buddy) in __igt_dump_block() 15 pr_err("block info: header=%llx, state=%u, order=%d, offset=%llx size=%llx root=%s buddy=%s\n", in __igt_dump_block() 22 yesno(buddy)); in __igt_dump_block() 28 struct i915_buddy_block *buddy; in igt_dump_block() local 32 buddy = get_buddy(block); in igt_dump_block() 33 if (buddy) in igt_dump_block() 34 __igt_dump_block(mm, buddy, true); in igt_dump_block() 40 struct i915_buddy_block *buddy; in igt_check_block() local 83 buddy = get_buddy(block); in igt_check_block() 85 if (!buddy in igt_check_block() 11 __igt_dump_block(struct i915_buddy_mm *mm, struct i915_buddy_block *block, bool buddy) __igt_dump_block() argument [all...] |
/kernel/linux/linux-5.10/drivers/gpu/drm/i915/ |
H A D | i915_buddy.c | 236 struct i915_buddy_block *buddy; in __i915_buddy_free() local 238 buddy = get_buddy(block); in __i915_buddy_free() 240 if (!i915_buddy_block_is_free(buddy)) in __i915_buddy_free() 243 list_del(&buddy->link); in __i915_buddy_free() 246 i915_block_free(buddy); in __i915_buddy_free() 345 struct i915_buddy_block *buddy; in i915_buddy_alloc_range() local 419 buddy = get_buddy(block); in i915_buddy_alloc_range() 420 if (buddy && in i915_buddy_alloc_range() 422 i915_buddy_block_is_free(buddy))) in i915_buddy_alloc_range()
|
/kernel/linux/linux-6.6/drivers/gpu/drm/ |
H A D | drm_buddy.c | 88 * @mm: DRM buddy manager to initialize 183 * @mm: DRM buddy manager to free 247 * drm_get_buddy - get buddy address 249 * @block: DRM buddy block 251 * Returns the corresponding buddy block for @block, or NULL 269 struct drm_buddy_block *buddy; in __drm_buddy_free() local 271 buddy = __get_buddy(block); in __drm_buddy_free() 273 if (!drm_buddy_block_is_free(buddy)) in __drm_buddy_free() 276 list_del(&buddy->link); in __drm_buddy_free() 279 drm_block_free(mm, buddy); in __drm_buddy_free() 337 struct drm_buddy_block *buddy; alloc_range_bias() local 496 struct drm_buddy_block *buddy; __alloc_range() local [all...] |
/kernel/linux/linux-6.6/drivers/gpu/drm/tests/ |
H A D | drm_buddy_test.c | 47 struct drm_buddy_block *block, bool buddy) in __dump_block() 49 kunit_err(test, "block info: header=%llx, state=%u, order=%d, offset=%llx size=%llx root=%d buddy=%d\n", in __dump_block() 52 drm_buddy_block_size(mm, block), !block->parent, buddy); in __dump_block() 58 struct drm_buddy_block *buddy; in dump_block() local 62 buddy = drm_get_buddy(block); in dump_block() 63 if (buddy) in dump_block() 64 __dump_block(test, mm, buddy, true); in dump_block() 70 struct drm_buddy_block *buddy; in check_block() local 113 buddy = drm_get_buddy(block); in check_block() 115 if (!buddy in check_block() 46 __dump_block(struct kunit *test, struct drm_buddy *mm, struct drm_buddy_block *block, bool buddy) __dump_block() argument [all...] |
/kernel/linux/linux-5.10/arch/loongarch/include/asm/ |
H A D | pgtable.h | 35 pte_t *buddy = ptep_buddy(ptep); in set_pte() local 37 * Make sure the buddy is global too (if it's !none, in set_pte() 49 "1:" __LL "%[tmp], %[buddy] \n" in set_pte() 52 __SC "%[tmp], %[buddy] \n" in set_pte() 57 : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) in set_pte() 60 if (pte_none(*buddy)) in set_pte() 61 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; in set_pte()
|
/kernel/linux/common_modules/tzdriver/core/ |
H A D | mailbox_mempool.c | 223 struct mb_page_t *buddy = NULL; in mailbox_free() local 249 buddy = &g_m_zone->pages[buddy_idx]; in mailbox_free() 251 /* is buddy free */ in mailbox_free() 252 if ((unsigned int)buddy->order == i && buddy->count == 0) { in mailbox_free() 253 /* release buddy */ in mailbox_free() 254 list_del(&buddy->node); in mailbox_free() 255 /* combine self and buddy */ in mailbox_free() 257 page = buddy->page; in mailbox_free() 258 buddy in mailbox_free() [all...] |
H A D | reserved_mempool.c | 449 struct reserved_page_t *buddy = NULL;
in buddy_merge() local 455 buddy = &g_res_zone->pages[buddy_idx];
in buddy_merge() 457 /* is buddy free */
in buddy_merge() 458 if (buddy->order == i && buddy->count == 0) {
in buddy_merge() 459 /* release buddy */
in buddy_merge() 460 list_del(&buddy->node);
in buddy_merge() 461 /* combine self and buddy */
in buddy_merge() 463 vpage = buddy->page;
in buddy_merge() 464 buddy in buddy_merge() [all...] |
/kernel/linux/linux-6.6/arch/loongarch/include/asm/ |
H A D | pgtable.h | 319 pte_t *buddy = ptep_buddy(ptep); in set_pte() local 321 * Make sure the buddy is global too (if it's !none, in set_pte() 333 "1:" __LL "%[tmp], %[buddy] \n" in set_pte() 336 __SC "%[tmp], %[buddy] \n" in set_pte() 341 : [buddy] "+m" (buddy->pte), [tmp] "=&r" (tmp) in set_pte() 344 if (pte_none(*buddy)) in set_pte() 345 pte_val(*buddy) = pte_val(*buddy) | _PAGE_GLOBAL; in set_pte()
|
/kernel/linux/linux-5.10/arch/mips/include/asm/ |
H A D | pgtable.h | 156 pte_t *buddy = ptep_buddy(ptep); local 158 * Make sure the buddy is global too (if it's !none, 161 if (pte_none(*buddy)) { 163 buddy->pte_low |= _PAGE_GLOBAL; 164 buddy->pte_high |= _PAGE_GLOBAL; 202 pte_t *buddy = ptep_buddy(ptep); local 204 * Make sure the buddy is global too (if it's !none, 208 cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL); 210 cmpxchg(&buddy->pte, 0, _PAGE_GLOBAL);
|
/kernel/linux/linux-6.6/arch/mips/include/asm/ |
H A D | pgtable.h | 130 pte_t *buddy = ptep_buddy(ptep); local 132 * Make sure the buddy is global too (if it's !none, 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 178 * Make sure the buddy is global too (if it's !none, 182 cmpxchg64(&buddy->pte, 0, _PAGE_GLOBAL); 184 cmpxchg(&buddy->pte, 0, _PAGE_GLOBAL);
|
/kernel/linux/linux-5.10/fs/ext4/ |
H A D | mballoc.c | 37 * - mb_mark_used() may allocate chunk right after splitting buddy 91 * prealloc then we look at the buddy cache. The buddy cache is represented 93 * mapped to the buddy and bitmap information regarding different 94 * groups. The buddy information is attached to buddy cache inode so that 97 * block bitmap and buddy information. The information are stored in the 101 * [ group 0 bitmap][ group 0 buddy] [group 1][ group 1]... 104 * one block each for bitmap and buddy information. So for each group we 109 * The buddy cach 620 void *buddy; __mb_check_buddy() local 714 ext4_mb_mark_free_simple(struct super_block *sb, void *buddy, ext4_grpblk_t first, ext4_grpblk_t len, struct ext4_group_info *grp) ext4_mb_mark_free_simple() argument 772 ext4_mb_generate_buddy(struct super_block *sb, void *buddy, void *bitmap, ext4_group_t group, struct ext4_group_info *grp) ext4_mb_generate_buddy() argument 830 void *buddy; mb_regenerate_buddy() local 1424 void *buddy = mb_find_buddy(e4b, order, &max); mb_buddy_mark_free() local 1566 void *buddy; mb_find_extent() local 1635 void *buddy; mb_mark_used() local 1969 void *buddy; ext4_mb_simple_scan_group() local [all...] |