Skip to content

Conversation

@MxkulSharma
Copy link

@MxkulSharma MxkulSharma commented Mar 14, 2024

Jemalloc by default is good because of :

  1. Reduced Fragmentation: jemalloc employs sophisticated algorithms to allocate memory in a way that minimizes fragmentation. This fragmentation occurs when freed memory becomes scattered in small chunks, making it difficult to allocate larger blocks efficiently. jemalloc's approach helps maintain contiguous memory regions, leading to faster allocation and deallocation operations.

  2. jemalloc excels in multi-threaded environments. It utilizes thread-caching mechanisms and per-thread allocation arenas to minimize contention and improve memory access speed for concurrent threads.

  3. jemalloc provides valuable debugging features that can aid in troubleshooting memory-related issues within the operating system. These tools can help pinpoint memory leaks, identify memory usage patterns, and diagnose allocation/deallocation problems, leading to a more stable and reliable system.

  4. It also make's the device perform well at higer load's and improve performance.

You can check other PR regarding this from these Links.

Build (1/5)
Build_soong (2/5)
Bionic (3/5)
external_jemalloc_new (4/5)
manifest (5/5)
System_core

Copy link
Member

@NurKeinNeid NurKeinNeid left a comment

Choose a reason for hiding this comment

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

Please drop unrelated commits first and you're missing system/core.

@MxkulSharma
Copy link
Author

MxkulSharma commented Mar 15, 2024

Please drop unrelated commits first and you're missing system/core.

Sure thank you for the feedback, i have droped all the unrelated commits and i can't find the missing commit for system/core, i will search for it and make a new pr later.
Thank you.

Copy link
Member

@NurKeinNeid NurKeinNeid left a comment

Choose a reason for hiding this comment

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

Weren't you wondering where 4/4 was? You should also always look at the original author at first. It originally comes from AOSPA.

https://gerrit.aospa.co/c/AOSPA/android_system_core/+/30308

@MxkulSharma
Copy link
Author

MxkulSharma commented Mar 16, 2024

Weren't you wondering where 4/4 was? You should also always look at the original author at first. It originally comes from AOSPA.

https://gerrit.aospa.co/c/AOSPA/android_system_core/+/30308

Weren't you wondering where 4/4 was? You should also always look at the original author at first. It originally comes from AOSPA.

https://gerrit.aospa.co/c/AOSPA/android_system_core/+/30308

i am sorry i assumed external_jemalloc as the last commit for it.

I wasn't aware of the origin author, I have given proper credited to all the new author with the force push.

System_core

@MxkulSharma MxkulSharma force-pushed the 14 branch 2 times, most recently from a7303e2 to 277e12d Compare March 16, 2024 07:58
@MxkulSharma MxkulSharma requested a review from NurKeinNeid March 16, 2024 07:59
Copy link
Member

@NurKeinNeid NurKeinNeid left a comment

Choose a reason for hiding this comment

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

I don't understand why you force pushed it and changed authorship. I didn't mention that at all. Everything was fine, now it's wrong.

@MxkulSharma
Copy link
Author

I don't understand why you force pushed it and changed authorship. I didn't mention that at all. Everything was fine, now it's wrong.

I will make it right now. Thank you.

Overall, jemalloc performs 10-20% better than Scudo while consuming
equivalent amount of memory in system/extra's real-world memory_replay
traces:

https://docs.google.com/spreadsheets/d/1E5d_YcU04i8zA-V0vcJgilONGICvR6ynfYGMAvSnMvg/edit?usp=sharing

Scudo performs fairly well for a hardened memory allocator, but we're
optimizing for performance.

Tests were performed by statically linking memory_replay under PA
Sapphire branch. Android userspace has been stopped before performing
all benchmarks, and each test was executed 10 times with an idle
detector in between to reduce noise and errors.

The entire test took about 18 hours:
https://github.com/arter97/android_memory_replay_helper

Few notes:

 - jemalloc shipped with android-12.1.0_r5, v5.1.0, performs
   consistently better than v5.2.1, especially with the camera trace,
   but generally consumes more memory.

 - jemalloc v5.3.0 is not benchmarked yet due to on going Android
   compatibility issues:
   jemalloc/jemalloc#2279

 - Scudo from android-12.1.0_r8 consumes 5.5% less memory compared to
   Qualcomm's Scudo, and the performance is equivalent (0.2% better).

This commit has been inspired from ProtonAOSP/android_bionic@b220489

Change-Id: I84264c07b1bc8c9dc69fd1dde48a2c7c9609d82d

Signed-off-by: MxkulSharma <sharmamukul06175@gmail.com>
Copy link
Member

@NurKeinNeid NurKeinNeid left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution. Looks good to me now but Pixels don't like these changes. I need to add the changed repos to be excluded in pixel branch manifest. But next weekend's I will be very busy with QPR2.

@MxkulSharma
Copy link
Author

Thanks for your contribution. Looks good to me now but Pixels don't like these changes. I need to add the changed repos to be excluded in pixel branch manifest. But next weekend's I will be very busy with QPR2.

ok no problem so should i keep these pr open or should i close them or do i need to exclude these repo from pixel branch?

@NurKeinNeid
Copy link
Member

Just keep the pull requests open. I have a lot of local uncommited changes because of qpr2 and cant tell yet if I will merge to qpr1 or qpr2 only and when I will find time.

@NurKeinNeid NurKeinNeid merged commit dc97f87 into DerpFest-AOSP:14 Mar 23, 2024
@NurKeinNeid
Copy link
Member

Still no system/core commit

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.

3 participants