Date: Wed, 28 Aug 2002 13:59:08 -0700 From: Jon Mini <mini@freebsd.org> To: Julian Elischer <julian@elischer.org> Cc: arch@FreeBSD.ORG Subject: Re: Process/thread states. Message-ID: <20020828205908.GB3751@elvis.mu.org> In-Reply-To: <Pine.BSF.4.21.0208261603020.83598-100000@InterJet.elischer.org> References: <Pine.BSF.4.21.0208261603020.83598-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer [julian@elischer.org] wrote : > #define TD_ST_SUSPQ 0x01 /* uses runq field */ > #define TD_ST_RUNQ 0x02 /* uses runq field */ > #define TD_ST_RUNNING 0x03 /* uses no (virtual) field */ > #define TD_ST_MTX 0x04 /* uses mtx field */ > #define TD_ST_RQ_MASK 0x07 /* mask of non sleep states */ > #define TD_ST_SLPQ 0x08 /* uses slpq field */ + #define TD_ST_UNBOUND 0x10 /* not bound to a KSE */ + #define TD_ST_UPCALL 0x20 /* scheduled for upcall */ > enum thread_state { > TDS_UNQUEUED = 0x00, > TDS_SLP = TD_ST_SLPQ, > TDS_RUNQ = TD_ST_RUNQ, > TDS_RUNNING = TD_ST_RUNNING, > TDS_SUSPENDED = TD_ST_SUSPQ, > TDS_MTX = TD_ST_MTX, > TDS_SUSP_SLP = TD_ST_SUSPQ|TD_ST_SLPQ, > TDS_RUN_SLP = TD_ST_RUNNING|TD_ST_SLPQ, > TDS_RUNQ_SLP = TD_ST_RUNQ|TD_ST_SLPQ, > TDS_MTX_SLP = TD_ST_MTX|TD_ST_SLPQ, > TDS_SWAPPING = TD_ST_SLPQ|TD_ST_RQ_MASK + 1, > TDS_IWAIT, /* needed? */ | TDS_SURPLUS = TDS_UNQUEUED|TD_ST_UNBOUND, + TDS_UPCALLING = TD_ST_RUNQ|TD_ST_UPCALL > }; This would make upcalls walk through the states like this: - In the UMA slab, the thread is TDS_SURPLUS - allocated as kse->ke_tdspare, still TDS_SURPLUS - thread_schedule_upcall() grabs it, and it becomes TDS_UPCALLING - thread_userret() sees it, it gets bound to a KSE, and becomes TDS_RUNNING just like any other currently running thread. I hate to add another state, especially for one so fleeting, but the current use of td_flags for this strikes me as a bit bogus. OTOH, "unused" (TDS_SURPLUS) is a totally valid state. -- Jonathan Mini <mini@freebsd.org> http://www.freebsd.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020828205908.GB3751>