Re: Consistent lock up 2.6.10-rc1-bk7 (mutex/SCHED_RR bug?)

From: Chris Wright
Date: Fri Oct 29 2004 - 12:17:45 EST


* Andrew A. (aathan-linux-kernel-1542@xxxxxxxxxxxxx) wrote:
> I suspect what is happening here is that my process is essentially in a
>
> while(1)
> {
> lock();
> unlock();
> }
>
> loop from two or mode SCHED_RR threads running at nice -15. They seem to be unkillable.

Give yourself a shell that's SCHED_RR with a higher priority. I've used
the small hack below to debug userspace SCHED_RR problems (newer distros
have a chrt utility to do this).

thanks,
-chris
--

#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sched.h>
#include <string.h>
#include <errno.h>

main(int argc, char *argv[])
{
pid_t pid = 0;
int priority = 99;
int policy = SCHED_RR;
struct sched_param sched;

if (argc > 1) {
pid = atoi(argv[1]);
if (argc > 2) {
priority = atoi(argv[2]);
if (argc > 3)
policy = atoi(argv[3]);
}
}

memset(&sched, 0, sizeof(sched));
sched.sched_priority = priority;
if (sched_setscheduler(pid, policy, &sched) < 0) {
printf("setscheduler: %s\n", strerror(errno));
exit(1);
}

if (!pid) { /* turn this into a shell */
argv[0] = "/bin/bash";
argv[1] = NULL;
execv(argv[0], argv);
}

}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/