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

To optimize the layout of the meta data of mem_slab & mem_pool #3866

Closed
zephyrbot opened this issue Jul 26, 2017 · 0 comments
Closed

To optimize the layout of the meta data of mem_slab & mem_pool #3866

zephyrbot opened this issue Jul 26, 2017 · 0 comments
Assignees
Labels
area: Kernel Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug

Comments

@zephyrbot
Copy link
Collaborator

zephyrbot commented Jul 26, 2017

Reported by Quanwen Du:

The suggestions here:

  1. For mem_slab, current logic is using the first 4bytes of the free buffer as NEXT pointer of free_list, then link all the free buffers together. But I suggest to use the tail 4bytes as NEXT pointer of free_list. As we know there are issues of memory overflow/corruption. If we move the NEXT to the tail 4bytes, then we have a bigger guard space, then even when memory overflow writing happens, it is lower possibility that the NEXT pointer will be corrupted. I know there is argument that we should let the corruption be visible earlier, but I think it shall be always right to reduce the impact of the overflow corruption
  2. There is similar suggestion for mem_pool, which puts the bitmap and level info at the end of the buffer. So the suggestion here is to change K_MEM_POOL_DEFINE: to move _mpool_lvls_##name before _mpool_buf_##name; also to define the bitmap of block availability before mpool_buf##name. Of cause this suggestion assumed the toolchain will layout these arrays per its definition sequence, I will assume this is the most case, so shall be OK to re-layout these arrays.

(Imported from Jira ZEP-2435)

@zephyrbot zephyrbot added priority: low Low impact/importance bug area: Kernel Enhancement Changes/Updates/Additions to existing features labels Sep 23, 2017
@nashif nashif closed this as completed Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Kernel Enhancement Changes/Updates/Additions to existing features priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

3 participants