Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib min_heap: rename min_heapify() to min_heap_sift_down()

After adding min_heap_sift_up(), the naming convention has been adjusted
to maintain consistency with the min_heap_sift_up(). Consequently,
min_heapify() has been renamed to min_heap_sift_down().

Link: https://lkml.kernel.org/CAP-5=fVcBAxt8Mw72=NCJPRJfjDaJcqk4rjbadgouAEAHz_q1A@mail.gmail.com
Link: https://lkml.kernel.org/r/20240524152958.919343-13-visitorckw@gmail.com
Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Bagas Sanjaya <bagasdotme@gmail.com>
Cc: Brian Foster <bfoster@redhat.com>
Cc: Ching-Chun (Jim) Huang <jserv@ccns.ncku.edu.tw>
Cc: Coly Li <colyli@suse.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kent Overstreet <kent.overstreet@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Matthew Sakai <msakai@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Kuan-Wei Chiu and committed by
Andrew Morton
bfe31271 2eb637c6

+9 -9
+1 -1
drivers/md/dm-vdo/repair.c
··· 183 183 */ 184 184 last = &repair->entries[--heap->nr]; 185 185 swap_mappings(heap->data, last, NULL); 186 - min_heapify(heap, 0, &repair_min_heap, NULL); 186 + min_heap_sift_down(heap, 0, &repair_min_heap, NULL); 187 187 return last; 188 188 } 189 189
+7 -7
include/linux/min_heap.h
··· 75 75 76 76 /* Sift the element at pos down the heap. */ 77 77 static __always_inline 78 - void __min_heapify(min_heap_char *heap, int pos, size_t elem_size, 78 + void __min_heap_sift_down(min_heap_char *heap, int pos, size_t elem_size, 79 79 const struct min_heap_callbacks *func, void *args) 80 80 { 81 81 void *left, *right; ··· 108 108 } 109 109 } 110 110 111 - #define min_heapify(_heap, _pos, _func, _args) \ 112 - __min_heapify((min_heap_char *)_heap, _pos, __minheap_obj_size(_heap), _func, _args) 111 + #define min_heap_sift_down(_heap, _pos, _func, _args) \ 112 + __min_heap_sift_down((min_heap_char *)_heap, _pos, __minheap_obj_size(_heap), _func, _args) 113 113 114 114 /* Sift up ith element from the heap, O(log2(nr)). */ 115 115 static __always_inline ··· 139 139 int i; 140 140 141 141 for (i = heap->nr / 2 - 1; i >= 0; i--) 142 - __min_heapify(heap, i, elem_size, func, args); 142 + __min_heap_sift_down(heap, i, elem_size, func, args); 143 143 } 144 144 145 145 #define min_heapify_all(_heap, _func, _args) \ ··· 158 158 /* Place last element at the root (position 0) and then sift down. */ 159 159 heap->nr--; 160 160 memcpy(data, data + (heap->nr * elem_size), elem_size); 161 - __min_heapify(heap, 0, elem_size, func, args); 161 + __min_heap_sift_down(heap, 0, elem_size, func, args); 162 162 163 163 return true; 164 164 } ··· 178 178 void *args) 179 179 { 180 180 memcpy(heap->data, element, elem_size); 181 - __min_heapify(heap, 0, elem_size, func, args); 181 + __min_heap_sift_down(heap, 0, elem_size, func, args); 182 182 } 183 183 184 184 #define min_heap_pop_push(_heap, _element, _func, _args) \ ··· 232 232 return true; 233 233 func->swp(data + (idx * elem_size), data + (heap->nr * elem_size), args); 234 234 __min_heap_sift_up(heap, elem_size, idx, func, args); 235 - __min_heapify(heap, idx, elem_size, func, args); 235 + __min_heap_sift_down(heap, idx, elem_size, func, args); 236 236 237 237 return true; 238 238 }
+1 -1
kernel/events/core.c
··· 3795 3795 3796 3796 *evt = perf_event_groups_next(*evt, pmu); 3797 3797 if (*evt) 3798 - min_heapify(&event_heap, 0, &perf_min_heap, NULL); 3798 + min_heap_sift_down(&event_heap, 0, &perf_min_heap, NULL); 3799 3799 else 3800 3800 min_heap_pop(&event_heap, &perf_min_heap, NULL); 3801 3801 }