Date: Mon, 24 Jan 2011 18:09:27 GMT From: Edward Tomasz Napierala <trasz@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 188132 for review Message-ID: <201101241809.p0OI9R4I026809@skunkworks.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@188132?ac=10 Change 188132 by trasz@trasz_victim on 2011/01/24 18:09:07 Get rid of %CPU dampening. This means the %CPU is not averaged now, but it's at least sometimes correct. Affected files ... .. //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#61 edit Differences ... ==== //depot/projects/soc2009/trasz_limits/sys/kern/kern_container.c#61 (text+ko) ==== @@ -161,17 +161,6 @@ } } -static int -container_resource_dampened(int resource) -{ - switch (resource) { - case RUSAGE_PCTCPU: - return (1); - default: - return (0); - } -} - static void container_add(struct container *dest, const struct container *src) { @@ -202,8 +191,7 @@ * Update resource usage in dest. */ for (i = 0; i <= RUSAGE_MAX; i++) { - if (!container_resource_sloppy(i) && - !container_resource_dampened(i)) { + if (!container_resource_sloppy(i)) { KASSERT(dest->c_resources[i] >= 0, ("resource usage propagation meltdown: dest < 0")); KASSERT(src->c_resources[i] >= 0, @@ -214,8 +202,7 @@ if (container_resource_reclaimable(i)) { dest->c_resources[i] -= src->c_resources[i]; if (dest->c_resources[i] < 0) { - KASSERT(container_resource_sloppy(i) || - container_resource_dampened(i), + KASSERT(container_resource_sloppy(i), ("container_sub: usage < 0")); dest->c_resources[i] = 0; } @@ -250,8 +237,6 @@ continue; if (!container_resource_reclaimable(i)) continue; - if (container_resource_dampened(i)) - continue; KASSERT(container->c_resources[i] == 0, ("destroying non-empty container: " "%ju allocated for resource %d\n", @@ -283,8 +268,7 @@ container->c_resources[resource] += amount; if (container->c_resources[resource] < 0) { - KASSERT(container_resource_sloppy(resource) || - container_resource_dampened(resource), + KASSERT(container_resource_sloppy(resource), ("container_alloc_resource: usage < 0")); container->c_resources[resource] = 0; } @@ -653,6 +637,7 @@ rusage_set(p, RUSAGE_NPTS, 0); rusage_set(p, RUSAGE_NTHR, 0); rusage_set(p, RUSAGE_RSS, 0); + rusage_set(p, RUSAGE_PCTCPU, 0); PROC_UNLOCK(p); #ifdef RCTL @@ -740,29 +725,6 @@ } static void -container_dampen_callback(struct container *container, void *arg2, void *arg3) -{ - int orig, diff, hz; - - hz = *(int *)arg2; - - mtx_lock(&container_lock); - orig = container->c_resources[RUSAGE_PCTCPU]; - KASSERT(orig >= 0, ("container_dampen_callback: orig < 0")); - if (orig == 0) { - mtx_unlock(&container_lock); - return; - } - diff = orig / 10; - if (diff == 0) - diff = 1; - container->c_resources[RUSAGE_PCTCPU] -= diff; - KASSERT(container->c_resources[RUSAGE_PCTCPU] >= 0, - ("container_dampen_callback: result < 0")); - mtx_unlock(&container_lock); -} - -static void containerd(void) { struct thread *td; @@ -771,11 +733,6 @@ uint64_t pctcpu, pctcpu_limit, runtime; for (;;) { - loginclass_container_foreach(container_dampen_callback, &hz, - NULL); - ui_container_foreach(container_dampen_callback, &hz, NULL); - prison_container_foreach(container_dampen_callback, &hz, NULL); - sx_slock(&allproc_lock); FOREACH_PROC_IN_SYSTEM(p) { microuptime(&wallclock);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101241809.p0OI9R4I026809>
