Sorry this got off a mailing list. Below is a proposed patch for handling an
issue where lrmd spawns all cluster resources with the realtime scheduler
class (SCHED_RR) set. I know on Linux that the default is SCHED_OTHER and
the code in the patch below is POSIX compliant, so hopefully it will not
cause issues for folks on other OSes.



---------- Forwarded message ----------
From: Andrew Beekhof <[email protected]>
Date: Thu, Apr 9, 2009 at 1:57 AM
Subject: Re: [Pacemaker] Resource Scheduler Parameters
To: btinsley <[email protected]>


dejan maintains the lrmd, you'd better send this to the heartbeat
mailing list (but it looks fine to me)

On Thu, Apr 9, 2009 at 01:42, btinsley <[email protected]> wrote:
> Nevermind, I think I found it... in the heartbeat source. Forgot about
that,
> but grep-ing Pacemaker code for fork/exec/clone code freaked me out for a
> little while ;-)
>
> If you want it, this patch should do the trick. It's POSIX compliant, so
> hopefully it won't be troublesome on other OSes ;-)  If I missed the mark
> completely here, the code can be placed wherever it's needed.
>
>
> --- lrmd.c.orig 2009-04-08 15:33:04.038843903 -0500
> +++ lrmd.c      2009-04-08 15:45:11.976099804 -0500
> @@ -34,6 +34,7 @@
>  #include <dirent.h>
>  #include <pwd.h>
>  #include <time.h>
> +#include <sched.h>
>
>  #include <glib.h>
>  #include <heartbeat.h>
> @@ -3087,6 +3088,15 @@
>                         return HA_OK;
>
>                 case 0:         /* Child */
> +                       if (sched_getscheduler(0) != SCHED_OTHER) {
> +                               lrmd_debug2(LOG_DEBUG,
> +                                       "perform_ra_op: resetting
scheduler
> class to SCHED_OTHER");
> +                               struct sched_param sp;
> +                               sp.sched_priority = 0;
> +                               if (sched_setscheduler(0, SCHED_OTHER,
&sp)
> == -1)
> +                                       cl_perror("%s::%d:
> sched_setscheduler",
> +                                               __FUNCTION__, __LINE__);
> +                       }
>                         /* Man: The call setpgrp() is equivalent to
> setpgid(0,0)
>                          * _and_ compiles on BSD variants too
>                          * need to investigate if it works the same too.
>
>
>
> On Wed, Apr 8, 2009 at 1:28 PM, btinsley <[email protected]> wrote:
>>
>> Where in the code are resources spawned? Is it start_subsystem() or
>> elsewhere? I'll be glad to pitch in and offer a patch if you want.
>>
>>
>>
>> On Wed, Apr 8, 2009 at 1:18 PM, Andrew Beekhof <[email protected]> wrote:
>>>
>>> On Wed, Apr 8, 2009 at 18:40, btinsley <[email protected]> wrote:
>>> > AIS guys said to upgrade to the latest Whitetank :-)  I did and the
>>> > behavior
>>> > is the same, but it's not necessarily incorrect. The aisexec process
>>> > sets
>>> > itself to the realtime scheduling class, which does the same for all
of
>>> > the
>>> > Pacemaker processes when they are spawned. This is probably how you
>>> > want the
>>> > cluster daemons to run. However, when lrmd spawns resource scripts
>>> > *everything* the script does also inherits the realtime scheduling
>>> > class.
>>> > I'm not sure this is how you want all your clustered applications
>>> > running
>>> > (or all the other stuff a resource script may do). Thoughts here?
>>>
>>> I'd tend to agree with you - the lrmd should probably do the
>>> equivalent of chrt for the child processes it uses to perform the
>>> resource actions
>>>
>>> > As a workaround, I added calls to the chrt program in each resource
>>> > script
>>> > to "downgrade" the scheduler to SCHED_OTHER and set the priority to
>>> > zero,
>>> > which is the system default.
>>>
>>> _______________________________________________
>>> Pacemaker mailing list
>>> [email protected]
>>> http://oss.clusterlabs.org/mailman/listinfo/pacemaker
>>
>
>
_______________________________________________________
Linux-HA-Dev: [email protected]
http://lists.linux-ha.org/mailman/listinfo/linux-ha-dev
Home Page: http://linux-ha.org/

Reply via email to