X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fswap.c;h=bb1398f688da5cb8f2cee76588b7e2e05a1584f3;hb=f5b51ea7fcb0b6380c3ceb4d4f3f22f647c6fd32;hp=de3a5d8b10f1755c23a941bd5e3dae654f569398;hpb=628c89cc68ab96fce2de7ebba5933725d147aecc;p=elogind.git diff --git a/src/core/swap.c b/src/core/swap.c index de3a5d8b1..bb1398f68 100644 --- a/src/core/swap.c +++ b/src/core/swap.c @@ -506,7 +506,7 @@ static void swap_set_state(Swap *s, SwapState state) { job_add_to_run_queue(UNIT(other)->job); } -static int swap_coldplug(Unit *u) { +static int swap_coldplug(Unit *u, Hashmap *deferred_work) { Swap *s = SWAP(u); SwapState new_state = SWAP_DEAD; int r; @@ -604,7 +604,11 @@ static int swap_spawn(Swap *s, ExecCommand *c, pid_t *_pid) { assert(c); assert(_pid); - unit_realize_cgroup(UNIT(s)); + (void) unit_realize_cgroup(UNIT(s)); + if (s->reset_cpu_usage) { + (void) unit_reset_cpu_usage(UNIT(s)); + s->reset_cpu_usage = false; + } r = unit_setup_exec_runtime(UNIT(s)); if (r < 0) @@ -830,6 +834,8 @@ static int swap_start(Unit *u) { return -EAGAIN; s->result = SWAP_SUCCESS; + s->reset_cpu_usage = true; + swap_enter_activating(s); return 1; }