Skip to content

Conversation

ewoodev
Copy link
Contributor

@ewoodev ewoodev commented Apr 10, 2025

If the CPU idle state is not present and lpwork is not running, the delayed free operation of sched_free may not function properly.

To check this, Add to display the size of any delayed free that has not yet been released in heapinfo command.


delayfree_resource = 0;
flags = enter_critical_section();
for (int cpu = 0; cpu < CONFIG_SMP_NCPUS; cpu++) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why only this particular code piece is needed to be in critical zone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flags = enter_critical_section();
tmp = heap->mm_delaylist[up_cpu_index()];
heap->mm_delaylist[up_cpu_index()] = NULL;
leave_critical_section(flags);
/* Test if the delayed is empty */
while (tmp)
{
FAR void *address;
/* Get the first delayed deallocation */
address = tmp;
tmp = tmp->flink;
/* The address should always be non-NULL since that was checked in the
* 'while' condition above.
*/
mm_free(heap, address);
}

Please refer above code lines.
If mm_heapinfo_parse_heap.c printing is excuting and other core is free delaylist, the information can be wrong or the data abort can be occured.

If the CPU idle state is not present and lpwork is not running, the delayed free operation
of sched_free may not function properly.

To check this, Add to display the size of any delayed free that has not yet been released in heapinfo command.

Signed-off-by: eunwoo.nam <eunwoo.nam@samsung.com>
@ewoodev ewoodev force-pushed the WORK-250410_dump_delay_free branch from 8dacc40 to db5c653 Compare August 25, 2025 07:27
@ewoodev ewoodev closed this Aug 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants