* Bosko Milekic <[EMAIL PROTECTED]> [010807 14:51] wrote:
> 
> On Tue, Aug 07, 2001 at 12:19:01PM -0700, Matt Dillon wrote:
> >     Cache line invalidation does not require an IPI.  TLB
> >     shootdowns require IPIs.  TLB shootdowns are unrelated to
> >     interrupt threads, they only occur when shared mmu mappings
> >     change.  Cache line invalidation can waste cpu cycles --
> >     when cache mastership changes occur between cpus due to
> >     threads being switched between cpus.  I consider this a
> >     serious problem in -current.
> 
>       I don't think it's fair to consider this a serious problem seeing as
> how, as far as I'm aware, we've intended to eventually introduce code that will
> favor keeping threads running on one CPU on that same CPU as long as it is
> reasonable to do so (which should be most of the time).
>       I think after briefly discussing with Alfred on IRC that Alfred has
> some CPU affinity patches on the way, but I'm not sure if they address
> thread scheduling with the above intent in mind or if they merely introduce
> an _interface_ to bind a thread to a single CPU.

They do both. :)  You can bind a process to a runqueue _and_ at the
same time as long as a process on another CPU doesn't have a much
higher priority we'll take from our local pool.

Basically we give processes that last ran on our own CPU a false
priority boost.

http://people.freebsd.org/~alfred/bind_cpu.diff

+       cpu = PCPU_GET(cpuid);
+       pricpu = runq_findbit(&runqcpu[cpu]);
+       pri = runq_findbit(rq);
+       CTR2(KTR_RUNQ, "runq_choose: pri=%d cpupri=%d", pri, pricpu);
+       if (pricpu != -1 && (pricpu < pri || pri == -1)) {
+               pri = pricpu;
+               rqh = &runqcpu[cpu].rq_queues[pri];
+       } else if (pri != -1) {
+               rqh = &rq->rq_queues[pri];
+       } else {
+               CTR1(KTR_RUNQ, "runq_choose: idleproc pri=%d", pri);
+               return (PCPU_GET(idleproc));
+       }
+       p = TAILQ_FIRST(rqh);

Actually I think this patch is stale, it doesn't have
the priority boost, but basically you can put it in the

if (pricpu != -1 && (pricpu < pri || pri == -1)) {

clause sort of like this:

if (pricpu != -1 && (pricpu - FUDGE < pri || pri == -1)) {

Where FUDGE is the priority boost you want to give local processes.

-- 
-Alfred Perlstein [[EMAIL PROTECTED]]
Ok, who wrote this damn function called '??'?
And why do my programs keep crashing in it?

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to