Skip to content

Commit 0949986

Browse files
authored
Merge pull request #4770 from mysterywolf/heap
[bug][kernel][heap] 将内存堆信号量保护机制由FIFO改为PRIO
2 parents 5c8625c + b2dd3f0 commit 0949986

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ void rt_system_heap_init(void *begin_addr, void *end_addr)
250250
rt_mem_setname(heap_end, "INIT");
251251
#endif
252252

253-
rt_sem_init(&heap_sem, "heap", 1, RT_IPC_FLAG_FIFO);
253+
rt_sem_init(&heap_sem, "heap", 1, RT_IPC_FLAG_PRIO);
254254

255255
/* initialize the lowest-free pointer to the start of the heap */
256256
lfree = (struct heap_mem *)heap_ptr;

src/memheap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ rt_err_t rt_memheap_init(struct rt_memheap *memheap,
155155
item->next_free = item->prev_free = RT_NULL;
156156

157157
/* initialize semaphore lock */
158-
rt_sem_init(&(memheap->lock), name, 1, RT_IPC_FLAG_FIFO);
158+
rt_sem_init(&(memheap->lock), name, 1, RT_IPC_FLAG_PRIO);
159159

160160
RT_DEBUG_LOG(RT_DEBUG_MEMHEAP,
161161
("memory heap: start addr 0x%08x, size %d, free list header 0x%08x\n",

src/slab.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ void rt_system_heap_init(void *begin_addr, void *end_addr)
363363
npages = limsize / RT_MM_PAGE_SIZE;
364364

365365
/* initialize heap semaphore */
366-
rt_sem_init(&heap_sem, "heap", 1, RT_IPC_FLAG_FIFO);
366+
rt_sem_init(&heap_sem, "heap", 1, RT_IPC_FLAG_PRIO);
367367

368368
RT_DEBUG_LOG(RT_DEBUG_SLAB, ("heap[0x%x - 0x%x], size 0x%x, 0x%x pages\n",
369369
heap_start, heap_end, limsize, npages));

0 commit comments

Comments
 (0)