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

umm_heap/valloc: support valloc (LEGACY) #2906

Merged
merged 2 commits into from Feb 26, 2021
Merged

umm_heap/valloc: support valloc (LEGACY) #2906

merged 2 commits into from Feb 26, 2021

Conversation

Donny9
Copy link
Contributor

@Donny9 Donny9 commented Feb 24, 2021

Summary

valloc has the same effect as malloc(), except that the allocated memory is aligned to a page boundary.
Reference:https://pubs.opengroup.org/onlinepubs/7908799/xsh/valloc.html

Impact

Testing

daily test

@yamt
Copy link
Contributor

yamt commented Feb 24, 2021

do you really need this obsolete api?

@Donny9
Copy link
Contributor Author

Donny9 commented Feb 24, 2021

do you really need this obsolete api?

Yes, we need it in memory api test(LTP).

@yamt
Copy link
Contributor

yamt commented Feb 24, 2021

do you really need this obsolete api?

Yes, we need it in memory api test(LTP).

do you mean LTP tests valloc? it doesn't sound like a good reason to introduce it in nuttx.

@xiaoxiang781216
Copy link
Contributor

do you really need this obsolete api?

Yes, we need it in memory api test(LTP).

do you mean LTP tests valloc?

Not test valloc, some LTP testcase call valloc to allocate the memory.

it doesn't sound like a good reason to introduce it in nuttx.

If nobody call valloc, linker will eliminate the code from final binary. On the other hand, we have to modify LTP to remove valloc.

@yamt
Copy link
Contributor

yamt commented Feb 24, 2021

do you really need this obsolete api?

Yes, we need it in memory api test(LTP).

do you mean LTP tests valloc?

Not test valloc, some LTP testcase call valloc to allocate the memory.

it doesn't sound like a good reason to introduce it in nuttx.

If nobody call valloc, linker will eliminate the code from final binary. On the other hand, we have to modify LTP to remove valloc.

ok. it (LTP as an app actually using valloc) sounds like a good reason to add it.

@davids5
Copy link
Contributor

davids5 commented Feb 24, 2021

Will you please Kconfig this and document it for what it is?

@btashton
Copy link
Contributor

Will you please Kconfig this and document it for what it is?

Why would this go behind Kconfig it has zero cost if it is not used?

@davids5
Copy link
Contributor

davids5 commented Feb 24, 2021

Sure you can argue "shoot em all " and let the linker sort it out. :)

I would do it so that the intent of the of why it was added is documented and left off and turned on for the project that wants to use it. If not it may end up C&P at litter that is not garbage collected.

@xiaoxiang781216
Copy link
Contributor

Sure you can argue "shoot em all " and let the linker sort it out. :)

I would do it so that the intent of the of why it was added is documented

is it not enough with the comment before valloc? And it isn't good to mention LTP in a general function.

and left off and turned on for the project that wants to use it.

NuttX already contains so many Kconfig, and it's already impossible to test all combination now. If the tool can do the selection automatically, it's wrong to add Kconfig in this case, because:

  1. It make harder to test all option combination
  2. Beginner also hard to do the right configuration

If not it may end up C&P at litter that is not garbage collected.

Since valloc contained in a standalone file, even the oldest linker can remove the unused object files without problem.

@davids5
Copy link
Contributor

davids5 commented Feb 24, 2021

is it not enough with the comment before valloc?

What comment? Did I miss it? Maybe add one, that labels it as obsolete and that will work.

And it isn't good to mention LTP in a general function.

LOL... I was referring to documenting it in the Kconfig. --help - Something to the effect "This is an obsolete function that can be enabled to be used by some third partly libraries that require it."

Beginner also hard to do the right configuration

Yes very true. You can say the same about a Beginner developer, new to NuttX, dealing with lots of functions that were added to to make the build work for a project that should not be used. and it not referenced anywhere in this project.

It is a case of information overload. Unqualified information - leaves the user overwhelmed. If you qualify it it it can be ignored.

I do see your point. I agree with it. Please add a comment and call it a done.

@patacongo
Copy link
Contributor

Wouldn't this be more appropriate under mmh/mm_heap where all of the other memory-related APIs from stdlib.h are implemented?

@Donny9
Copy link
Contributor Author

Donny9 commented Feb 24, 2021

Wouldn't this be more appropriate under mmh/mm_heap where all of the other memory-related APIs from stdlib.h are implemented?

okay, i done in this PR.

@Donny9 Donny9 changed the title libc/valloc: support valloc umm_heap/valloc: support valloc (LEGACY) Feb 24, 2021
@xiaoxiang781216
Copy link
Contributor

@davids5 and @patacongo can we merge this PR now?

@davids5
Copy link
Contributor

davids5 commented Feb 26, 2021

@davids5 and @patacongo can we merge this PR now?

is it not enough with the comment before valloc

Did the OBSOLETE comment get added?

Reference:
https://pubs.opengroup.org/onlinepubs/7908799/xsh/valloc.html

Change-Id: Ieb425a77b0a8d758956996d201223a0050ae4920
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
Signed-off-by: Jiuzhu Dong <dongjiuzhu1@xiaomi.com>
@Donny9
Copy link
Contributor Author

Donny9 commented Feb 26, 2021

@davids5 and @patacongo can we merge this PR now?

is it not enough with the comment before valloc

Did the OBSOLETE comment get added?

Done!

@davids5 davids5 merged commit fecc68d into apache:master Feb 26, 2021
@btashton btashton added this to To-Add in Release Notes - 10.1.0 Apr 12, 2021
@jerpelea jerpelea moved this from To-Add to core in Release Notes - 10.1.0 Apr 13, 2021
@jerpelea jerpelea moved this from core to Added in Release Notes - 10.1.0 Apr 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

6 participants