From owner-freebsd-stable@FreeBSD.ORG Tue Jun 12 13:08:23 2012 Return-Path: Delivered-To: freebsd-stable@FreeBSD.ORG Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 81F1A1065761 for ; Tue, 12 Jun 2012 13:08:23 +0000 (UTC) (envelope-from momchil@xaxo.eu) Received: from vps2.xaxo.eu (vps2.xaxo.eu [78.47.156.66]) by mx1.freebsd.org (Postfix) with ESMTP id 150FF8FC0C for ; Tue, 12 Jun 2012 13:08:22 +0000 (UTC) Received: from t61.xaxo.eu ([10.75.23.6]) by vps2.xaxo.eu (8.14.4/8.14.4) with ESMTP id q5CC8Iax097354; Tue, 12 Jun 2012 14:08:19 +0200 (CEST) (envelope-from momchil@xaxo.eu) Date: Tue, 12 Jun 2012 15:08:20 +0200 Message-ID: <86zk88isor.wl%momchil@xaxo.eu> From: Momchil Ivanov To: freebsd-stable@FreeBSD.ORG, momchil@xaxo.eu In-Reply-To: <201206121203.q5CC3AA2002709@lurza.secnetix.de> References: <861ulkkflm.wl%momchil@xaxo.eu> <201206121203.q5CC3AA2002709@lurza.secnetix.de> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Cc: Subject: Re: ULE Scheduler X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2012 13:08:23 -0000 At Tue, 12 Jun 2012 14:03:10 +0200 (CEST), Oliver Fromme wrote: > > Momchil Ivanov wrote: > > I was just curious why both processes are hopping around, > > because I would naively think that should not happen. > > I'll try to explain ... > > There are always many more processes and threads being executed > beside the two CPU-bound ones that you see at the top of the > top(1) display. For example, there are at least 15 threads > inside the kernel (see "ps -auxww") that are scheduled every > now and then. Or look at "vmstat -i" output to see the > interrupt statistics: Several hundred times per second, > the interrupt handlers have to be executed. > > So, what happens is that an interrupt occurs (from a hardware > clock, from a hard disk controller, from an input device, or > anything else). Then your process is _removed_ from the core > on which it is currently executing, and the interrupt handler > starts executing. The same can happen on the second core at > the same time, because different kernel threads can execute > simultaneously (if they don't share resources). Now, if the > interrupt handler on one of the two cores is done, your own > process has a chance to be scheduled again. In this moment, > it does not matter at all on which core it is going to be > executed. The only difference is cache contents, but the > first-level-caches are usually too small anyway. The ULE > scheduler takes a lot of information into account when making > the decision, including cache affinity (the 4BSD scheduler > doesn't know about that at all). So the L2 cache is shared between both cores and hence it's size does not matter at all?