Date: Mon, 11 Jun 2012 10:22:31 +0100 From: "Robert N. M. Watson" <rwatson@freebsd.org> To: Konstantin Belousov <kostikbel@gmail.com> Cc: arch@freebsd.org Subject: Re: Fast gettimeofday(2) and clock_gettime(2) Message-ID: <E316FFF8-7718-45C8-88F7-3A725B54E976@freebsd.org> In-Reply-To: <20120611091811.GA2337@deviant.kiev.zoral.com.ua> References: <20120606165115.GQ85127@deviant.kiev.zoral.com.ua> <alpine.BSF.2.00.1206110952570.78881@fledge.watson.org> <20120611091811.GA2337@deviant.kiev.zoral.com.ua>
index | next in thread | previous in thread | raw e-mail
On 11 Jun 2012, at 10:18, Konstantin Belousov wrote: >> 3) For the purposes of adaptive mutexes in userspace, it really would be >> quite >> nice to know whether remote threads are running or not, in the same way >> that cheap access to remote thread run state in the kernel makes for much >> more efficient adaptive spinning. I wonder if we could use this >> mechanism >> for that purpose as well. I guess for now, at least, you're using a >> single >> global page, but in the future, per-process pages might be quite >> beneficial. > > The per-process page looks almost undoable. I think that what could be > made working, although with some hacks, is per-CPU page, and the page > content update on context switch. This could benefit trivial system calls > like getpid(), getppid() and others, but obviously cause increased context > switch latency. > > Per-CPU page would then solve the proposal of having an indicator of > other threads running. I am not sure how much do we care of the potential > information leak there. FYI, the FreeBSD/MIPS kernel already makes use of an MD per-thread page using a reserved TLB entry switched on each kernel context switch. Interestingly, this model effectively conflicts (semantically) with the higher-level MI per-CPU mechanism. It would be nice to unify across the layers within the kernel, even if not all the way to userspace. Roberthelp
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E316FFF8-7718-45C8-88F7-3A725B54E976>
