Skip to contentSkip to conversation

Limiting max cpu usage per user (old Conectiva patch)

DISCUSSION Frederik Dannemare 4 participants 5 messages Nov 27, 2002

lore
Share & tools
lore
#1 lore raw
Quoted 6 lines · Frederik Dannemare

do we have an effective way to limit max cpu usage per user? I haven't been able to find much useful info except for an old thread on lkml, where Rik van Riel mentions[1] a 2.2 kernel patch by Conectiva.

Anybody knows if this patch (or similar functionality) been ported to 2.4 (or 2.5)?

It's on my patches page:

http://surriel.com/patches/

cheers,

Rik

Signature · 3 lines
Bravely reimplemented by the knights who say "NIH".
http://www.surriel.com/		http://guru.conectiva.com/
Current spamtrap:  <a href=mailto:"[email protected]">[email protected]</a>
#2 lore raw
Quoted 5 lines · On Wed, 27 Nov 2002 10:08:56 -0200 (BRST) Rik van Riel <[email protected]>…

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
Signature · 1 line
		- Hu Gang
#3 lore raw
In reply to Rik van Riel
Quoted 6 lines · Rik van Riel
Quoted 4 lines · Frederik Dannemare

do we have an effective way to limit max cpu usage per user? I haven't been able to find much useful info except for an old thread on lkml, where Rik van Riel mentions[1] a 2.2 kernel patch by Conectiva.

Quoted 7 lines
Quoted 2 lines

Anybody knows if this patch (or similar functionality) been ported to 2.4 (or 2.5)?

It's on my patches page:

http://surriel.com/patches/

Great. Many thanks. I'll go test it right away.

--
Frederik

#4 lore raw
In reply to Frederik Dannemare

hi :)

Quoted 1 line · Frederik Dannemare

do we have an effective way to limit max cpu usage per user?

i'm working on a resource container implementation for linux for my diploma thesis.

resource container provide a hierarchical way to account and limit resources.
this way not only per user limits can be achieved, but any policy you can think of (per service, per client, ...)

the work is due january, but interested people could have a look at the (undocumented for now ;) source earlier.

Signature · 10 lines
CU,		  / Friedrich-Alexander University Erlangen, Germany
Martin Waitz	//  [Tali on IRCnet]  [tali.home.pages.de] _________
______________/// - - - - - - - - - - - - - - - - - - - - ///
dies ist eine manuell generierte mail, sie beinhaltet    //
tippfehler und ist auch ohne grossbuchstaben gueltig.   /
			    -
Wer bereit ist, grundlegende Freiheiten aufzugeben, um sich 
kurzfristige Sicherheit zu verschaffen, der hat weder Freiheit 
noch Sicherheit verdient.
			Benjamin Franklin  (1706 - 1790)