public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* pam and nice-rt-prio-rlimits
@ 2005-03-14  9:14 Vegard Lima
  2005-03-14 21:43 ` Matt Mackall
  0 siblings, 1 reply; 3+ messages in thread
From: Vegard Lima @ 2005-03-14  9:14 UTC (permalink / raw)
  To: linux-kernel

Hello,

in the long thread on "[request for inclusion] Realtime LSM" there
doesn't appear to be too many people who has actually tested the
nice-and-rt-prio-rlimits.patch. Well, it works for me...

However, the patch to pam_limits posted here:
  http://lkml.org/lkml/2005/1/14/174
is a little bit aggressive on the semi-colon side.

Tested patch (and pam.src.rpm for fedora c3) can be found here
  http://home.hia.no/~vegardl/rlimit/
and below

--- Linux-PAM-0.77/modules/pam_limits/pam_limits.c.rtprio	2005-03-13 16:15:07.000000000 +0100
+++ Linux-PAM-0.77/modules/pam_limits/pam_limits.c	2005-03-13 16:27:54.000000000 +0100
@@ -39,6 +39,11 @@
 #include <grp.h>
 #include <pwd.h>
 
+/* Hack to test new rlimit values */
+#define RLIMIT_NICE	13
+#define RLIMIT_RTPRIO	14
+#define RLIM_NLIMITS	15
+
 /* Module defines */
 #define LINE_LENGTH 1024
 
@@ -293,6 +298,10 @@
     else if (strcmp(lim_item, "locks") == 0)
 	limit_item = RLIMIT_LOCKS;
 #endif
+    else if (strcmp(lim_item, "rt_priority") == 0)
+	limit_item = RLIMIT_RTPRIO;
+    else if (strcmp(lim_item, "nice") == 0)
+	limit_item = RLIMIT_NICE;
     else if (strcmp(lim_item, "maxlogins") == 0) {
 	limit_item = LIMIT_LOGIN;
 	pl->flag_numsyslogins = 0;
@@ -360,6 +369,18 @@
         case RLIMIT_AS:
             limit_value *= 1024;
             break;
+        case RLIMIT_NICE:
+            if (limit_value > 39)
+		limit_value = 39;
+	    if (limit_value < 0)
+		limit_value = 0;
+            break;
+        case RLIMIT_RTPRIO:
+            if (limit_value > 99)
+		limit_value = 99;
+	    if (limit_value < 0)
+		limit_value = 0;
+            break;
     }
 
     if ( (limit_item != LIMIT_LOGIN)



Thanks,
-- 
Vegard Lima



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pam and nice-rt-prio-rlimits
  2005-03-14  9:14 pam and nice-rt-prio-rlimits Vegard Lima
@ 2005-03-14 21:43 ` Matt Mackall
  2005-03-14 23:13   ` Vegard Lima
  0 siblings, 1 reply; 3+ messages in thread
From: Matt Mackall @ 2005-03-14 21:43 UTC (permalink / raw)
  To: Vegard Lima; +Cc: linux-kernel

On Mon, Mar 14, 2005 at 10:14:17AM +0100, Vegard Lima wrote:
> Hello,
> 
> in the long thread on "[request for inclusion] Realtime LSM" there
> doesn't appear to be too many people who has actually tested the
> nice-and-rt-prio-rlimits.patch. Well, it works for me...
> 
> However, the patch to pam_limits posted here:
>   http://lkml.org/lkml/2005/1/14/174
> is a little bit aggressive on the semi-colon side.

It would be more helpful if you pointed out the exact bug. But I think
I spotted the bug in question the first time around.

Please double-check and test this patch from -mm, which will likely
show up in mainline:

http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11/2.6.11-mm3/broken-out/nice-and-rt-prio-rlimits.patch

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: pam and nice-rt-prio-rlimits
  2005-03-14 21:43 ` Matt Mackall
@ 2005-03-14 23:13   ` Vegard Lima
  0 siblings, 0 replies; 3+ messages in thread
From: Vegard Lima @ 2005-03-14 23:13 UTC (permalink / raw)
  To: Matt Mackall; +Cc: linux-kernel

må den 14.03.2005 Klokka 13:43 (-0800) skreiv Matt Mackall:
> On Mon, Mar 14, 2005 at 10:14:17AM +0100, Vegard Lima wrote:
> > Hello,
> > 
> > in the long thread on "[request for inclusion] Realtime LSM" there
> > doesn't appear to be too many people who has actually tested the
> > nice-and-rt-prio-rlimits.patch. Well, it works for me...
> > 
> > However, the patch to pam_limits posted here:
> >   http://lkml.org/lkml/2005/1/14/174
> > is a little bit aggressive on the semi-colon side.
> 
> It would be more helpful if you pointed out the exact bug. But I think
> I spotted the bug in question the first time around.

Sorry, the incremental patch looks like this

--- Linux-PAM-0.77/modules/pam_limits/pam_limits.c-rtprio	2005-03-15 00:04:30.000000000 +0100
+++ Linux-PAM-0.77/modules/pam_limits/pam_limits.c	2005-03-15 00:04:58.000000000 +0100
@@ -370,16 +370,15 @@
             limit_value *= 1024;
             break;
         case RLIMIT_NICE:
-            limit_value = 19 - limit_value;
             if (limit_value > 39)
 		limit_value = 39;
-	    if (limit_value < 0);
+	    if (limit_value < 0)
 		limit_value = 0;
             break;
         case RLIMIT_RTPRIO:
             if (limit_value > 99)
 		limit_value = 99;
-	    if (limit_value < 0);
+	    if (limit_value < 0)
 		limit_value = 0;
             break;
     }


The conversion
  limit_value = 19 - limit_value;
takes place in can_nice() in kernel/schec.c and had to be removed.

> Please double-check and test this patch from -mm, which will likely
> show up in mainline:
> 
> http://www.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.11/2.6.11-mm3/broken-out/nice-and-rt-prio-rlimits.patch

Sound good.
I've tested with both 2.6.11-mm3 and 2.6.11-bk10 + patch above.
jackd starts OK with realtime scheduling and playing with nice seems OK
when I have positive values for "rt_priority" and "nice" in limits.conf.


Thanks,
-- 
Vegard Lima


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-03-14 23:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-14  9:14 pam and nice-rt-prio-rlimits Vegard Lima
2005-03-14 21:43 ` Matt Mackall
2005-03-14 23:13   ` Vegard Lima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox