core: add IODeviceLatencyTargetSec#9247
Conversation
src/core/cgroup.h
Outdated
| struct CGroupIODeviceLatency { | ||
| LIST_FIELDS(CGroupIODeviceLatency, device_latencies); | ||
| char *path; | ||
| uint64_t target_usec; |
poettering
left a comment
There was a problem hiding this comment.
looks pretty good, just some minor comments
| <listitem> | ||
| <para>Set the per-device average target I/O latency for the executed processes, if the unified control group | ||
| hierarchy is used on the system. Takes a space-separated pair of a file path and a timespan value to specify | ||
| the device specific latency target. (Example: "/dev/sda 25ms"). The file path may be specified |
There was a problem hiding this comment.
maybe use <literal>…</literal> here, rather than ""
src/core/cgroup.c
Outdated
| return n; | ||
| } | ||
|
|
||
| static unsigned cgroup_apply_io_device_latency(Unit *u, const char *dev_path, uint64_t target) { |
There was a problem hiding this comment.
uint64_t target → usec_t target?
src/core/cgroup.c
Outdated
|
|
||
| LIST_FOREACH_SAFE(device_latencies, l, next, c->io_device_latencies) { | ||
| if (!cgroup_apply_io_device_latency(u, l->path, l->target_usec)) | ||
| cgroup_context_free_io_device_latency(c, l); |
There was a problem hiding this comment.
hmm, so applying these might modify the loaded unit file state?
I am seeing the existing code already did it like that, but I wonder if this is a good idea. I am pretty sure we should leave configuration unmodified by reality, if you so will. I mean, devices come and go, and I think our policy should be here that we apply what we can apply, and if we cant' apply it now, then we should handle it gracefully, but if we maybe can apply it safely later, for example because a device appeared, we should do it then. i.e. truly graceful best-effort behaviour.
but dunno, mayb it's ok to get in like this for now, but I am pretty sure we should clean that up sooner or later
There was a problem hiding this comment.
Hmm... yeah maybe. I have no idea why all the device io configs try to ditch configs if the device lookup fails or the config is the default. Maybe it's to conserve memory? Given that they're all tied to a cgroup's lifetime, just keeping them around no matter what should be fine, I think.
There was a problem hiding this comment.
someone called Tejun Heo added that bit in 979d031. Maybe we should ask him ;-)
There was a problem hiding this comment.
I prepped #9275 now, which drops this bit. PTAL. (and rebase on top of it after that's merged)
There was a problem hiding this comment.
I completely forgot that it was me. Gees. Anyways, yeah, I can't think of downsides of just keeping the configs around.
|
Hmm, I made some changes to the block device resolving and validation code in #9255. I figure this PR should follow the same logic of those changes as soon as it gets merged. |
keszybz
left a comment
There was a problem hiding this comment.
There is a mismatch between the docs and the checks for valid paths, but @poettering already handled that in #9255.
| <listitem> | ||
| <para>Set the per-device average target I/O latency for the executed processes, if the unified control group | ||
| hierarchy is used on the system. Takes a space-separated pair of a file path and a timespan value to specify | ||
| the device specific latency target. (Example: "/dev/sda 25ms"). The file path may be specified |
There was a problem hiding this comment.
Takes a file path and a timespan separated by a space …
(I know this just copies existing text.)
src/core/cgroup.c
Outdated
| r = cg_set_attribute("io", u->cgroup_path, "io.latency", buf); | ||
| if (r < 0) | ||
| log_unit_full(u, IN_SET(r, -ENOENT, -EROFS, -EACCES) ? LOG_DEBUG : LOG_WARNING, r, | ||
| "Failed to set io.latency: %m"); |
There was a problem hiding this comment.
"Failed to set io.latency on cgroup %s: %", u->cgroup_path) ?
src/shared/bus-unit-util.c
Outdated
| target = e+1; | ||
|
|
||
| r = parse_sec(target, &usec); | ||
|
|
|
Applied changes for all comments except for #9255. Will rebase on top once it's merged. |
|
Please rebase. |
|
looks good to me, but let's wait until the upstream kernel feature is merged and until after the upcoming v239 release. |
Summary: New upstream release, plus backports of systemd/systemd#9244 systemd/systemd#9247 and systemd/systemd#9410 Reviewed By: jaymzh Differential Revision: D8609874 fbshipit-source-id: a620516cb7bc4305b144c811aa5eac5d19dc8274
This adds support for the following proposed latency based IO control mechanism. https://lkml.org/lkml/2018/6/5/428
|
This pull request fixes 4 alerts when merging b874a67 into 98b0b11 - view on LGTM.com fixed alerts:
Comment posted by LGTM.com |
|
blk-iolatency got merged into block/for-next and will be pulled into Linus's tree when v4.19-rc1 window opens. |
|
blk-iolatency is available in 4.19.0-0.rc0.git6.1.fc30.x86_64, let's merge. |
|
This pull request fixes 4 alerts when merging b874a67 into 71d1700 - view on LGTM.com fixed alerts:
Comment posted by LGTM.com |
This adds support for the following proposed latency based IO control
mechanism.
https://lkml.org/lkml/2018/6/5/428
This should be merged after the kernel feature is merged. Submitting
now for early review.