Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 23 Oct 2000 09:57:01 -0700 (PDT)
From:      Matthew Jacob <mjacob@feral.com>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        freebsd-smp@freebsd.org
Subject:   Re: cvs commit: src/sys/sys mutex.h 
Message-ID:  <Pine.LNX.4.21.0010230949140.9395-100000@zeppo.feral.com>
In-Reply-To: <13423.972326495@critter>

next in thread | previous in thread | raw e-mail | index | archive | help
> 
> Well, my take on this is that the main problem is that curproc is two
> entirely different things for SMP vs UP.  That clearly makes all KLD's
> toast unless compiled for the right thing.  That needs fixed.
> 
> In general "#ifdef SMP" should be minimized and in particular no
> KLD's should need to know about it.
> 
> I think a function to get the current thread/proc should not require
> <sys/proc.h> to be included, most places just need to pass a reference,
> they don't need to even know how the entrails of a proccess is 
> arranged, so obviously they should not need <sys/proc.h> #included.

From solaris:

extern kthread_id_t     threadp(void);  /* inline, returns thread pointer */
#define curthread       (threadp())     /* current thread pointer */
#define curproc         (ttoproc(curthread))    /* current process */

Strictly speaking, not an inline- but instead a per-platform locore.s
function- on sun4u it's:


        retl
        mov     THREAD_REG, %o0

On i86 it's:

        movl    %gs:CPU_THREAD, %eax
        ret


This approach solves the KLD issue. But we have to get everyone to agree that
even UP kernels have to pay the cost of even trivial function reference
instead of linktime binding.

Anyone else have some comments? 

-matt






To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-smp" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0010230949140.9395-100000>