From owner-freebsd-hackers@FreeBSD.ORG Mon Oct 29 19:16:17 2012 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6CA4E9F6; Mon, 29 Oct 2012 19:16:17 +0000 (UTC) (envelope-from asmrookie@gmail.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 7A3A28FC0A; Mon, 29 Oct 2012 19:16:16 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id b5so4240099lbd.13 for ; Mon, 29 Oct 2012 12:16:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=m01FhFJZuiJxFIxBalbUfF/jK4C0goMW1cI9OSHOKa0=; b=Sh53C21c58J3SgN5fW0iFWf4njHXglR2xpcrGXdNEQUqgRzga+XR0QcEm+huUfvrKJ SbrXkuSigY5AB/6esEXPvqdslXeHHTGZtXb4QakaDYYQpwapTAMQx+YbNeAphfg3Fo3X cVhP62PwLlgr0yyHGnhioMJqOD5s9yqAfJlFuSgj5IIuLaJtedeYJ/D02XZ5J9jAD+TV yUX3mjjNsrtLa8JsaQdwJSjmcmafGmBOp/dQWW6/8NciE7kaCzNhUDjTBQAkwTKDPAJX g2e4VJPcODeKsGZEjMveIkd6hYH/zF0NOfSVay6aV70e+sgie8zvdcFW4riEFTuOe+Hr FMjQ== MIME-Version: 1.0 Received: by 10.112.47.129 with SMTP id d1mr12097638lbn.115.1351538175274; Mon, 29 Oct 2012 12:16:15 -0700 (PDT) Sender: asmrookie@gmail.com Received: by 10.112.30.37 with HTTP; Mon, 29 Oct 2012 12:16:15 -0700 (PDT) In-Reply-To: References: <50587F8D.9060102@FreeBSD.org> <5058C68B.1010508@FreeBSD.org> <50596019.5060708@FreeBSD.org> <505AF836.7050004@FreeBSD.org> <506C461F.2050008@FreeBSD.org> Date: Mon, 29 Oct 2012 19:16:15 +0000 X-Google-Sender-Auth: Pxz3vGO4SdZIZ16PU5YDUF9LoKw Message-ID: Subject: Re: ule+smp: small optimization for turnstile priority lending From: Attilio Rao To: Jeff Roberson Content-Type: text/plain; charset=UTF-8 Cc: freebsd-hackers , Andriy Gapon X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: attilio@FreeBSD.org List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Oct 2012 19:16:17 -0000 On Mon, Oct 29, 2012 at 6:59 PM, Attilio Rao wrote: [ trimm ] > This also let me wonder about the tdq_lowpri check in the self case, > in general. Basically it forces sched_pickcpu() to select self if and > only if the new thread to schedule has an higher priority than the > lowest one on curcpu. Why is that like this? Exactly this check is > used to enforce some sort of fairness? > It would be good if Jeff spends a word or two on this check specifically. Also, I've read the code of tdq_setlowpri() more closely and I think the name tdq_lowpri is highly misleading, because that seems to me the *highest* priority thread that gets returned. Said that, this means that self will be selected in sched_pickcpu() if and only if the new thread has an higher priority than all the ones on the self runqueue. Isn't all this a bit too extreme? Assuming that one cpu has only a single high-priority thread and others are very loaded it would likely make sense to not keep loading them but switch to the self one, maybe. > Anyway the patch that implements what suggested, let me know your > thinking about it: > http://www.freebsd.org/~attilio/avg_ule2.patch I was thinking that however, maybe we could do the tdq_choose() calculation if self == target, to have a little more chances to get the optimization in place, eventually. Thanks, Attilio -- Peace can only be achieved by understanding - A. Einstein