diff options
author | WaLyong Cho <walyong.cho@samsung.com> | 2014-05-16 00:09:34 +0900 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-05-22 07:13:56 +0900 |
commit | 95ae05c0e79868c22b3e8e6fbc53432786876730 (patch) | |
tree | 874e9eb9902db34ded1e65ef88bbaf29d2f5aa4e /src/core/manager.c | |
parent | 7e4f9431caf4be39f39b64634f7708d7ca217d41 (diff) |
core: add startup resource control option
Similar to CPUShares= and BlockIOWeight= respectively. However only
assign the specified weight during startup. Each control group
attribute is re-assigned as weight by CPUShares=weight and
BlockIOWeight=weight after startup. If not CPUShares= or
BlockIOWeight= be specified, then the attribute is re-assigned to each
default attribute value. (default cpu.shares=1024, blkio.weight=1000)
If only CPUShares=weight or BlockIOWeight=weight be specified, then
that implies StartupCPUShares=weight and StartupBlockIOWeight=weight.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r-- | src/core/manager.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index d0af6741ed..65e7b2604d 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -456,6 +456,10 @@ int manager_new(SystemdRunningAs running_as, Manager **_m) { if (r < 0) goto fail; + r = set_ensure_allocated(&m->startup_units, trivial_hash_func, trivial_compare_func); + if (r < 0) + goto fail; + r = set_ensure_allocated(&m->failed_units, trivial_hash_func, trivial_compare_func); if (r < 0) goto fail; @@ -794,6 +798,7 @@ void manager_free(Manager *m) { hashmap_free(m->watch_pids2); hashmap_free(m->watch_bus); + set_free(m->startup_units); set_free(m->failed_units); sd_event_source_unref(m->signal_event_source); @@ -2445,6 +2450,9 @@ bool manager_unit_inactive_or_pending(Manager *m, const char *name) { void manager_check_finished(Manager *m) { char userspace[FORMAT_TIMESPAN_MAX], initrd[FORMAT_TIMESPAN_MAX], kernel[FORMAT_TIMESPAN_MAX], sum[FORMAT_TIMESPAN_MAX]; usec_t firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec; + Unit *u = NULL; + Iterator i; + UnitActiveState state; assert(m); @@ -2532,6 +2540,14 @@ void manager_check_finished(Manager *m) { NULL); } + SET_FOREACH(u, m->startup_units, i) { + u = set_steal_first(m->startup_units); + state = unit_active_state(u); + if (!UNIT_IS_ACTIVE_OR_ACTIVATING(state)) + continue; + cgroup_context_apply(m, unit_get_cgroup_context(u), unit_get_cgroup_mask(u), u->cgroup_path); + } + bus_manager_send_finished(m, firmware_usec, loader_usec, kernel_usec, initrd_usec, userspace_usec, total_usec); sd_notifyf(false, |