Bug#433793: linux-image-2.6.18-5-vserver-amd64: Vserver sched_hard flag not working
Package: linux-image-2.6.18-5-vserver-amd64
Version: 2.6.18.dfsg.1-13
Severity: important
Tags: patch
Adding the sched_hard option to a vserver's flags file and adding a
correct schedule file should limit the cpu ressources the vserver can
use.
The fill-rate / interval ratio should define the percentage of cpu time
the vserver can use.
Setting a fill-rate / interval ratio of 10 / 100 does not limit the
vserver's cpu usage at all.
Setting a fill-rate / interval ratio of 50 / 100 halts the vserver
almost completely.
This might be an overflow issue as
cat /proc/virtual/2005/sched
quiet often shows large negative values for the 'Token:' value.
The attached patch applied to the debian kernel source fixed the issue
for me.
According to Herbert Poetzl this issue is limited to Debian kernels
-- System Information:
Debian Release: 4.0
APT prefers proposed-updates
APT policy: (500, 'proposed-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-minto
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Versions of packages linux-image-2.6.18-5-vserver-amd64 depends on:
ii coreutil 5.97-5.3 The GNU core utilities
ii debconf 1.5.11 Debian configuration management sy
ii e2fsprog 1.39+1.40-WIP-2006.11.14+dfsg-2 ext2 file system utilities and lib
ii initramf 0.85h tools for generating an initramfs
ii module-i 3.3-pre4-2 tools for managing Linux kernel mo
Versions of packages linux-image-2.6.18-5-vserver-amd64 recommends:
ii util-vserver 0.30.212-1 user-space tools for Linux-VServer
-- debconf information:
shared/kernel-image/really-run-bootloader: true
linux-image-2.6.18-5-vserver-amd64/postinst/old-dir-initrd-link-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/postinst/bootloader-error-2.6.18-5-vserver-amd64:
linux-image-2.6.18-5-vserver-amd64/postinst/depmod-error-2.6.18-5-vserver-amd64: false
linux-image-2.6.18-5-vserver-amd64/postinst/bootloader-test-error-2.6.18-5-vserver-amd64:
linux-image-2.6.18-5-vserver-amd64/postinst/old-initrd-link-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/postinst/create-kimage-link-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/preinst/overwriting-modules-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/postinst/kimage-is-a-directory:
linux-image-2.6.18-5-vserver-amd64/preinst/already-running-this-2.6.18-5-vserver-amd64:
linux-image-2.6.18-5-vserver-amd64/postinst/depmod-error-initrd-2.6.18-5-vserver-amd64: false
linux-image-2.6.18-5-vserver-amd64/postinst/old-system-map-link-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/prerm/removing-running-kernel-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/preinst/abort-overwrite-2.6.18-5-vserver-amd64:
linux-image-2.6.18-5-vserver-amd64/preinst/lilo-has-ramdisk:
linux-image-2.6.18-5-vserver-amd64/prerm/would-invalidate-boot-loader-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/preinst/initrd-2.6.18-5-vserver-amd64:
linux-image-2.6.18-5-vserver-amd64/preinst/lilo-initrd-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/preinst/elilo-initrd-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/preinst/bootloader-initrd-2.6.18-5-vserver-amd64: true
linux-image-2.6.18-5-vserver-amd64/preinst/abort-install-2.6.18-5-vserver-amd64:
linux-image-2.6.18-5-vserver-amd64/preinst/failed-to-move-modules-2.6.18-5-vserver-amd64:
diff -ruN linux-source-2.6.16.orig/include/linux/vserver/sched_def.h linux-source-2.6.16/include/linux/vserver/sched_def.h
--- linux-source-2.6.16.orig/include/linux/vserver/sched_def.h 2006-06-13 08:54:15.000000000 +0200
+++ linux-source-2.6.16/include/linux/vserver/sched_def.h 2006-06-13 08:56:54.000000000 +0200
@@ -21,10 +21,10 @@
atomic_t tokens; /* number of CPU tokens */
spinlock_t tokens_lock; /* lock for token bucket */
- int fill_rate; /* Fill rate: add X tokens... */
- int interval; /* Divisor: per Y jiffies */
- int tokens_min; /* Limit: minimum for unhold */
- int tokens_max; /* Limit: no more than N tokens */
+ uint32_t fill_rate; /* Fill rate: add X tokens... */
+ uint32_t interval; /* Divisor: per Y jiffies */
+ uint32_t tokens_min; /* Limit: minimum for unhold */
+ uint32_t tokens_max; /* Limit: no more than N tokens */
uint32_t jiffies; /* last time accounted */
int priority_bias; /* bias offset for priority */
diff -ruN linux-source-2.6.16.orig/kernel/vserver/sched.c linux-source-2.6.16/kernel/vserver/sched.c
--- linux-source-2.6.16.orig/kernel/vserver/sched.c 2006-06-13 08:54:18.000000000 +0200
+++ linux-source-2.6.16/kernel/vserver/sched.c 2006-06-13 08:57:40.000000000 +0200
@@ -29,7 +29,7 @@
*/
int vx_tokens_recalc(struct vx_info *vxi)
{
- long delta, tokens = 0;
+ uint32_t delta, tokens = 0;
if (vx_info_flags(vxi, VXF_SCHED_PAUSE, 0))
/* we are paused */
Reply to: