Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6f3c362b authored by Chungkai Mei's avatar Chungkai Mei
Browse files

Parallel Module Loading: Add performance mode



Add the performance mode. It improved parallel module loading performance by enabling the main thread to identify any new independent modules without waiting for subthreads to load all the old independent threads.

Bug: 385049709
Change-Id: I638bc2d7d8fea6457be503c2b7aecd975250835a
Signed-off-by: default avatarChungkai Mei <chungkai@google.com>
parent 341f7e96
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -442,6 +442,9 @@ int FirstStageMain(int argc, char** argv) {
    if (bootconfig.find("androidboot.load_modules_parallel = \"true\"")
        != std::string::npos)
        want_parallel_mode = Modprobe::LoadParallelMode::NORMAL;
    else if (bootconfig.find("androidboot.load_modules_parallel_mode = \"performance\"")
        != std::string::npos)
        want_parallel_mode = Modprobe::LoadParallelMode::PERFORMANCE;

    boot_clock::time_point module_start_time = boot_clock::now();
    int module_count = 0;
+1 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@ class Modprobe {
    enum LoadParallelMode {
      NONE = 0,
      NORMAL,
      PERFORMANCE,
    };

    Modprobe(const std::vector<std::string>&, const std::string load_file = "modules.load",
+3 −1
Original line number Diff line number Diff line
@@ -546,7 +546,9 @@ bool Modprobe::LoadModulesParallel(int num_threads, int mode) {
            if (sequential_modules.empty() && parallel_modules.empty()) {
                sleeping_threads++;

                if (mode == LoadParallelMode::NORMAL && sleeping_threads == num_threads)
                if (mode == LoadParallelMode::PERFORMANCE)
                    cv_update_module.notify_one();
                else if (mode == LoadParallelMode::NORMAL && sleeping_threads == num_threads)
                    cv_update_module.notify_one();

                cv_load_module.wait(lock, [&](){