Re: Limiting max cpu usage per user (old Conectiva patch)

hugang
2002-11-27T13:47:22Z

On Wed, 27 Nov 2002 10:08:56 -0200 (BRST)
Rik van Riel <riel@conectiva.com.br> wrote:

> It's on my patches page:
>
> http://surriel.com/patches/
>
> cheers,
The patch is works. Here is the test.
w.c
-------
#include <stdio.h>
main()
{
while(1);
}

-------
start 5 w as normal user..
start 5 w as root user.

Enabel the fairsched
echo 1 > /proc/sys/kernel/fairsched
PID USER PRI NI SIZE RSS SHARE STAT %CPU %MEM TIME COMMAND
976 root 20 0 248 248 204 R 13.1 0.0 0:28 w
974 root 20 0 248 248 204 R 12.9 0.0 0:28 w
975 root 20 0 248 248 204 R 12.9 0.0 0:28 w
973 root 17 0 248 248 204 R 12.5 0.0 0:29 w
972 root 14 0 248 248 204 R 11.9 0.0 0:30 w
968 hugang 20 0 252 252 208 R 7.1 0.0 0:18 w
970 hugang 20 0 252 252 208 R 7.1 0.0 0:17 w
967 hugang 20 0 252 252 208 R 5.9 0.0 0:19 w
969 hugang 20 0 252 252 208 R 5.9 0.0 0:17 w
966 hugang 14 0 252 252 208 R 5.9 0.0 0:20 w

Disabel the fairsched
echo 0 > /proc/sys/kernel/fairsched
969 hugang 16 0 252 252 208 R 9.7 0.0 0:20 w
970 hugang 16 0 252 252 208 R 9.7 0.0 0:19 w
966 hugang 16 0 252 252 208 R 9.5 0.0 0:23 w
974 root 16 0 248 248 204 R 9.5 0.0 0:32 w
968 hugang 16 0 252 252 208 R 9.5 0.0 0:20 w
975 root 16 0 248 248 204 R 9.5 0.0 0:32 w
976 root 16 0 248 248 204 R 9.5 0.0 0:32 w
972 root 16 0 248 248 204 R 9.5 0.0 0:34 w
967 hugang 16 0 252 252 208 R 9.1 0.0 0:21 w
973 root 16 0 248 248 204 R 8.9 0.0 0:33 w

--
- Hu Gang