Re: [linux-audio-dev] best LL kernel options with ingo molnar's patch

From: Fernando Lopez-Lezcano <nando@email-addr-hidden>
Date: Thu Jul 07 2005 - 01:17:06 EEST

On Wed, 2005-07-06 at 13:52, Maarten De Boer wrote:
> Hi,
>
> Thanks for the reply.
>
> > > CONFIG_PREEMPT_RT: Complete Preemption (Real-Time)
> >
> > [...]
> >
> > AFAIK this one.
>
> Hm, I am currently trying PREEMPT_DESKTOP.
> I got the impression _RT would be a bit of overkill for audio work.
>
> > Unfortunately, I also try to get decent audio on my 2.6.12
> > machine but it seems to be tricky.
> >
> > After enabling the above option and kernel installation, you
> > need to patch PAM and configure it accordingly or you need to
> > try set-rtlimits.
>
> Is this documented somewhere?

This is (attached patch files) what I'm currently using for pam on
Planet CCRMA with the latest kernels. You may not want to be that
liberal about who can use what, of course.

(all based on: http://www.steamballoon.com/wiki/Rlimits)
-- Fernando

This one allows you to place nice values in the limits.conf

--- Linux-PAM-0.77/modules/pam_limits/pam_limits.c.prio 2005-01-14 10:47:03.000000000 -0800
+++ Linux-PAM-0.77/modules/pam_limits/pam_limits.c 2005-01-14 10:55:13.000000000 -0800
@@ -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 @@ static void process_limit(int source, co
     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,19 @@ static void process_limit(int source, co
         case RLIMIT_AS:
             limit_value *= 1024;
             break;
+ case RLIMIT_NICE:
+ limit_value = 19 - limit_value;
+ 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)

--- Linux-PAM-0.77/modules/pam_limits/limits.skel~ 2002-05-09 05:03:57.000000000 -0700
+++ Linux-PAM-0.77/modules/pam_limits/limits.skel 2005-05-09 15:12:42.000000000 -0700
@@ -31,6 +31,10 @@
 # - priority - the priority to run user process with
 # - locks - max number of file locks the user can hold
 #
+# realtime priority access:
+# - rt_priority - max realtime priority a process can use
+# - nice - max nice priority a process can be set to
+#
 #<domain> <type> <item> <value>
 #
 
@@ -42,4 +46,19 @@
 #ftp hard nproc 0
 #@student - maxlogins 4
 
+# limit realtime and memory locking access to users in the group audio
+# there is no way to say "allow locking all memory", 4G should be enough
+#
+#* - rt_priority 0
+#* - nice 0
+#
+#@audio - rt_priority 100
+#@audio - nice -10
+#@audio - memlock 4000000
+
+# or (default) allow everyone access
+* - rt_priority 100
+* - nice -10
+* - memlock 4000000
+
 # End of file
Received on Thu Jul 7 16:19:32 2005

This archive was generated by hypermail 2.1.8 : Thu Jul 07 2005 - 16:19:32 EEST