Date: Sat, 1 May 2004 12:09:19 -0400 (EDT) From: Daniel Eischen <eischen@vigrid.com> To: Petri Helenius <pete@he.iki.fi> Cc: freebsd-threads@freebsd.org Subject: Re: system priorities Message-ID: <Pine.GSO.4.10.10405011203040.13965-100000@pcnet5.pcnet.com> In-Reply-To: <4093C611.40600@he.iki.fi>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 1 May 2004, Petri Helenius wrote:
> Daniel Eischen wrote:
>
> >>This sounds like a bug. Could it change the KSEG which called the rtprio
> >>so there would be some deterministic behaviour to the rtprio if used in
> >>threaded program? So I take it from this that rtprio is also broken for
> >>libthr?
> >>
> >>
> >
> >Yes.
> >
> >
> >
> Can and should it be fixed?
Index: kern/kern_resource.c
===================================================================
RCS file: /opt/FreeBSD/cvs/src/sys/kern/kern_resource.c,v
retrieving revision 1.136
diff -u -r1.136 kern_resource.c
--- kern/kern_resource.c 10 Apr 2004 11:08:16 -0000 1.136
+++ kern/kern_resource.c 1 May 2004 14:00:37 -0000
@@ -318,6 +318,7 @@
{
struct proc *curp;
register struct proc *p;
+ struct ksegrp *kg;
struct rtprio rtp;
int cierror, error;
@@ -328,6 +329,7 @@
cierror = 0;
curp = td->td_proc;
+ kg = td->td_ksegrp;
if (uap->pid == 0) {
p = curp;
PROC_LOCK(p);
@@ -342,7 +344,7 @@
if ((error = p_cansee(td, p)))
break;
mtx_lock_spin(&sched_lock);
- pri_to_rtp(FIRST_KSEGRP_IN_PROC(p), &rtp);
+ pri_to_rtp(kg, &rtp);
mtx_unlock_spin(&sched_lock);
PROC_UNLOCK(p);
return (copyout(&rtp, uap->rtp, sizeof(struct rtprio)));
@@ -373,7 +375,7 @@
}
}
mtx_lock_spin(&sched_lock);
- error = rtp_to_pri(&rtp, FIRST_KSEGRP_IN_PROC(p));
+ error = rtp_to_pri(&rtp, kg);
mtx_unlock_spin(&sched_lock);
break;
default:
Index: kern/kern_thread.c
===================================================================
RCS file: /opt/FreeBSD/cvs/src/sys/kern/kern_thread.c,v
retrieving revision 1.176
diff -u -r1.176 kern_thread.c
--- kern/kern_thread.c 28 Apr 2004 20:36:53 -0000 1.176
+++ kern/kern_thread.c 1 May 2004 14:06:50 -0000
@@ -337,7 +337,7 @@
kg->kg_numupcalls = 0;
/* link it in now that it's consistent */
p->p_numksegrps++;
- TAILQ_INSERT_HEAD(&p->p_ksegrps, kg, kg_ksegrp);
+ TAILQ_INSERT_TAIL(&p->p_ksegrps, kg, kg_ksegrp);
}
void
> >
> >The Solaris priocntl() lets you set/get:
> >
> > P_LWPID
> > The id argument is an LWP ID. The priocntl function
> > applies to the LWP with the specified ID within the
> > calling process.
> >
> >
> >
> Where would I get the "P_LWPID"? I´m not sure it's a good idea to expose
> the kse structure to an application using pthreads.
There would be a way to get it, but you needn't if you
use P_MYID. Solaris has _lwp_self(). One of the other
things on my wish list is to be able to bind (soft
affinity) KSEs to processors.
--
Dan Eischen
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10405011203040.13965-100000>
