xiaoxiang781216 commented on PR #2159: URL: https://github.com/apache/nuttx-apps/pull/2159#issuecomment-1790785723
> The elements in the list are just pointers to heap: > > ``` > FAR struct mm_delaynode_s *tmp = mem; > irqstate_t flags; > > /* Delay the deallocation until a more appropriate time. */ > > flags = spin_lock_irqsave(&heap->mm_spinlock); > > tmp->flink = heap->mm_delaylist[up_cpu_index()]; > heap->mm_delaylist[up_cpu_index()] = tmp; > > spin_unlock_irqrestore(&heap->mm_spinlock, flags); > ``` > > When freeing the list a local copy is taken and the list is terminated, after that the list cannot be accessed from anywhere else > > ``` > FAR struct mm_delaynode_s *tmp; > irqstate_t flags; > > /* Move the delay list to local */ > > flags = spin_lock_irqsave(&heap->mm_spinlock); > > tmp = heap->mm_delaylist[up_cpu_index()]; > heap->mm_delaylist[up_cpu_index()] = NULL; > > spin_unlock_irqrestore(&heap->mm_spinlock, flags); > ``` > > Isn't it just possible to do this for each CPU (although it will increase the processing time of mm_delaylist for all CPUs). For a high CPU count this won't fly either I guess... > No, since the memory held by other cpu's delay list may point to the stack which belong to active task. > Should I make an issue on nuttx kernel ? So we don't forget this issue exists.. Yes, please. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
