mirror of
https://github.com/apache/nuttx.git
synced 2025-12-16 09:45:18 +08:00
sched/cpu: replace up_cpu_index() to this_cpu()
In SMP mode, up_cpu_index()/this_cpu() are the same, both return the index of the physical core. In AMP mode, up_cpu_index() will return the index of the physical core, and this_cpu() will always return 0 | #ifdef CONFIG_SMP | # define this_cpu() up_cpu_index() | #elif defined(CONFIG_AMP) | # define this_cpu() (0) | #else | # define this_cpu() (0) | #endif Signed-off-by: chao an <anchao@lixiang.com>
This commit is contained in:
@@ -189,11 +189,11 @@ static void add_delaylist(FAR struct mm_heap_s *heap, FAR void *mem)
|
||||
|
||||
flags = up_irq_save();
|
||||
|
||||
tmp->flink = heap->mm_delaylist[up_cpu_index()];
|
||||
heap->mm_delaylist[up_cpu_index()] = tmp;
|
||||
tmp->flink = heap->mm_delaylist[this_cpu()];
|
||||
heap->mm_delaylist[this_cpu()] = tmp;
|
||||
|
||||
#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
|
||||
heap->mm_delaycount[up_cpu_index()]++;
|
||||
heap->mm_delaycount[this_cpu()]++;
|
||||
#endif
|
||||
|
||||
up_irq_restore(flags);
|
||||
@@ -215,21 +215,21 @@ static bool free_delaylist(FAR struct mm_heap_s *heap, bool force)
|
||||
|
||||
flags = up_irq_save();
|
||||
|
||||
tmp = heap->mm_delaylist[up_cpu_index()];
|
||||
tmp = heap->mm_delaylist[this_cpu()];
|
||||
|
||||
#if CONFIG_MM_FREE_DELAYCOUNT_MAX > 0
|
||||
if (tmp == NULL ||
|
||||
(!force &&
|
||||
heap->mm_delaycount[up_cpu_index()] < CONFIG_MM_FREE_DELAYCOUNT_MAX))
|
||||
heap->mm_delaycount[this_cpu()] < CONFIG_MM_FREE_DELAYCOUNT_MAX))
|
||||
{
|
||||
up_irq_restore(flags);
|
||||
return false;
|
||||
}
|
||||
|
||||
heap->mm_delaycount[up_cpu_index()] = 0;
|
||||
heap->mm_delaycount[this_cpu()] = 0;
|
||||
#endif
|
||||
|
||||
heap->mm_delaylist[up_cpu_index()] = NULL;
|
||||
heap->mm_delaylist[this_cpu()] = NULL;
|
||||
|
||||
up_irq_restore(flags);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user