Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

os/drivers, os/mm: Modify mm_manage_allocfail to print alignment #6606

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kishore-sn
Copy link
Contributor

Modify mm_manage_allocfail API to print alignment value for which the allocation has failed.

@@ -149,7 +149,7 @@ static int mminfo_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
#ifdef CONFIG_APP_BINARY_SEPARATION
case MMINFOIOC_MNG_ALLOCFAIL:
/* There is a single heap for user. So start and end indexes of heap are always 0. */
mm_manage_alloc_fail(BASE_HEAP, 0, 0, ((struct mm_alloc_fail_s *)arg)->size, USER_HEAP
mm_manage_alloc_fail(BASE_HEAP, 0, 0, ((struct mm_alloc_fail_s *)arg)->size, ((struct mm_alloc_fail_s *)arg)->align, USER_HEAP
Copy link
Contributor

Choose a reason for hiding this comment

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

With this additional value - align, can we know this is failed because of alignment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added more logic for this. Please review.

Modify mm_manage_allocfail API to print alignment value for which
the allocation has failed. Also, print the largest available free
node with the required alignment.

Sample output:

Memalign case
=================================================================
mm_manage_alloc_fail: Allocation failed from user heap.
mm_manage_alloc_fail:  - requested size 524288
mm_manage_alloc_fail:  - requested alignment 131072
mm_manage_alloc_fail:  - caller address = 0x0e16d1c1
mm_manage_alloc_fail:  - largest un-aligned free size : 655344
mm_manage_alloc_fail:  - largest algined free size : 524272
mm_manage_alloc_fail:  - total free size   : 1524896
=================================================================

Malloc case
=================================================================
mm_manage_alloc_fail: Allocation failed from user heap.
mm_manage_alloc_fail:  - requested size 524288
mm_manage_alloc_fail:  - caller address = 0x0e16d1bd
mm_manage_alloc_fail:  - largest free size : 476208
mm_manage_alloc_fail:  - total free size   : 476288
=================================================================

Signed-off-by: Kishore S N <[email protected]>
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