struct rt_info * sched_gmua(struct list_head *head, struct global_sched_domain *g) { struct rt_info *it, *n, *best_tdead = NULL; struct rt_info *best_dead[NR_CPUS]; int cpu_id, cpus = count_global_cpus(g); for(cpu_id = 0; cpu_id < NR_CPUS; cpu_id++) best_dead[cpu_id] = NULL; list_for_each_entry_safe(it, n, head, task_list[GLOBAL_LIST]) { if(check_task_failure(it, SCHED_FLAG_NONE)) { _remove_task_global(it, g); continue; } livd(it, false, SCHED_FLAG_NONE); initialize_lists(it); if(!best_tdead) best_tdead = it; else if(insert_on_list(it, best_tdead, LIST_TDEAD, SORT_KEY_DEADLINE, 0)) best_tdead = it; } if(!best_tdead) goto out; initialize_cpu_state(); /* Assign the zero in degree tasks to the processors */ it = best_tdead; do { cpu_id = find_processor(cpus); insert_cpu_task(it, cpu_id); update_cpu_exec_times(cpu_id, it, true); it = task_list_entry(it->task_list[LIST_TDEAD].next, LIST_TDEAD); } while(it != best_tdead); for(cpu_id = 0; cpu_id < cpus; cpu_id++) { best_dead[cpu_id] = create_feasible_schedule(cpu_id); } build_list_array(best_dead, cpus); out: return best_dead[0]; }
/** \brief Parse an architecture string and defines the triplet accordingly. * * This function parses the \p arch parameter in an architecture triplet. * If the architecture information is invalid, then the function returns * false and this architecture object is not modified. * * The input is an architecture triplet where the \<vendor> part is optional. * Also the system understands a certain number of architectures that are * one word abbreviations such as "linux" which means "linux-i386", and * "win64" which means "win64-amd64". * * The list of operating systems and processors supported can be listed * using the os_list() and the processor_list() functions. * * When a vendor is specified, the operating system and the processor must * also be present or the function returns false (error.) * * You may set the architecture to the empty architecture by using the * empty string as the \p arch parameter. * * \param[in] arch The architecture triplet defined as: \<os>-\<vendor>-\<processor>. * * \return true if the \p arch parameter was a valid architecture string. */ bool architecture::set(const std::string& arch) { // the empty architecture if(arch.empty()) { f_os = ""; f_vendor = ""; f_processor = ""; return true; } // valid on any architecture (but not a pattern) if(arch == "all") { f_os = "all"; f_vendor = "all"; f_processor = "all"; return true; } // special case of a source package if(arch == "src" || arch == "source") { f_os = "all"; f_vendor = "all"; f_processor = "source"; return true; } // any triplet if(arch == "any") { f_os = "any"; f_vendor = "any"; f_processor = "any"; return true; } std::string os; std::string vendor(UNKNOWN_VENDOR); std::string processor; const std::string::size_type p(arch.find_first_of('-')); if(p == std::string::npos) { // <abbreviation> const abbreviation_t *abbr(find_abbreviation(arch)); if(abbr == NULL) { // unknown abbreviation return false; } os = abbr->f_os; processor = abbr->f_processor; } else { // an architecture name cannot start with a '-' if(p == 0) { // same as testing 'os.empty()' return false; } os = arch.substr(0, p); const std::string::size_type q(arch.find_first_of('-', p + 1)); if(q == std::string::npos) { // <os>-<processor> processor = arch.substr(p + 1); if(processor.empty()) { return false; } } else { // <os>-<vendor>-<processor> vendor = arch.substr(p + 1, q - p - 1); processor = arch.substr(q + 1); // should we allow for an empty vendor? if(vendor.empty() || processor.empty()) { return false; } if(!valid_vendor(vendor)) { return false; } } } // here we have a semi-valid triplet in os, vendor, and processor // variables now we want to verify that these are valid (supported) // architecture parameters as found in our lists and as we are at // it we canonicalize const os_t *co(find_os(os)); const processor_t *cp(find_processor(processor, true)); if(co == NULL || cp == NULL) { return false; } f_os = co->f_name; f_vendor = vendor; f_processor = cp->f_name; return true; }