From owner-freebsd-stable@freebsd.org Tue Nov 1 21:22:16 2016 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88E3AC2A8AF for ; Tue, 1 Nov 2016 21:22:16 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-pf0-x230.google.com (mail-pf0-x230.google.com [IPv6:2607:f8b0:400e:c00::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F3FD51D05 for ; Tue, 1 Nov 2016 21:22:15 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-pf0-x230.google.com with SMTP id i88so7728993pfk.2 for ; Tue, 01 Nov 2016 14:22:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=mfls6sD3IUyKlPAkGE+i+kcxnIzjmKf62+sPEKoKjGQ=; b=gqhE9yGtkl7QPfxBXbfY66aQSIRYaQpb7FZX9phOzlwm2pD+OU6j5sstVTBDQYRjyS PDIIuShL/kBo7MbvPz7I0Kro1Cfrw507S2voTY84wFOjYIN8DtbxqMrNhzuhz59FvaCi ENlFmjM8h9SRu+h0QqunaPbAnlX+gCMhWaHTg+JzMPP/CNsR7ipdW77xG0Lvl1qyOaew +7t9UOgfUjL+S2bNo0KRT4OC/krIeviLVPV9SrmcieqNJzot5bOwnZBN3wSmT2Bz8tAZ kDIM9Zb6K7lu5PYIMZ4+rQ2bmVOLizj5xzz5ZVeksTGXZVuPGVvlZ9v/IFKoWMTNjZL5 1R+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=mfls6sD3IUyKlPAkGE+i+kcxnIzjmKf62+sPEKoKjGQ=; b=WnHEL+yGI05sZZCWGpfX2P/4jSILw/vj94ao0Za0JxuncSJ3zYnNIyk8iHBsnSjMCs a7UnWLsSXlzlERyPsevjdxGxhQZ4TlpskEq/PsoNjlQMxubW30qyXh+JWofpvy2ENOTt DExG5VTalbexK0rS64eclTf2IY9aEQ9g2cK2hffH9zODt+S+B7O+xVcV0Y1zYaahiw3+ gwHoAvq/SkX/B/QCzfFFF5VTv8TAVLKtM7bhKQbRzIPesLViHux0WpD5reS+bH4+z+4w DLHHgCdbFvnWlvW3OBsczY4BkMnDk0qg7DtQxRkEPANu6mUUMVdr+c4kcNt420aVYinB Ha4g== X-Gm-Message-State: ABUngve8uH90gWyHGKEgya24uIEJGcoKH1WIN5atCPkTYtNWBUP7Funx+L8bjJf9Ukl5Tw== X-Received: by 10.98.160.29 with SMTP id r29mr95029pfe.103.1478035335082; Tue, 01 Nov 2016 14:22:15 -0700 (PDT) Received: from corona.austin.rr.com (c-67-188-30-11.hsd1.ca.comcast.net. [67.188.30.11]) by smtp.googlemail.com with ESMTPSA id xk6sm44337566pab.26.2016.11.01.14.22.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 14:22:14 -0700 (PDT) Subject: Re: huge nanosleep variance on 11-stable To: freebsd-stable@freebsd.org References: From: Jason Harmening Message-ID: <6167392c-c37a-6e39-aa22-ca45435d6088@gmail.com> Date: Tue, 1 Nov 2016 14:29:13 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HDJ66P9oeeKbWwFf87EVABbhlNgJwSWjQ" X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 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, 01 Nov 2016 21:22:16 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HDJ66P9oeeKbWwFf87EVABbhlNgJwSWjQ Content-Type: multipart/mixed; boundary="CwVNp2n6VHORNLW5VDPT3ugoQViEouw1S"; protected-headers="v1" From: Jason Harmening To: freebsd-stable@freebsd.org Message-ID: <6167392c-c37a-6e39-aa22-ca45435d6088@gmail.com> Subject: Re: huge nanosleep variance on 11-stable References: In-Reply-To: --CwVNp2n6VHORNLW5VDPT3ugoQViEouw1S Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable repro code is at http://pastebin.com/B68N4AFY if anyone's interested. On 11/01/16 13:58, Jason Harmening wrote: > Hi everyone, >=20 > I recently upgraded my main amd64 server from 10.3-stable (r302011) to > 11.0-stable (r308099). It went smoothly except for one big issue: > certain applications (but not the system as a whole) respond very > sluggishly, and video playback of any kind is extremely choppy. >=20 > The system is under very light load, and I see no evidence of abnormal > interrupt latency or interrupt load. More interestingly, if I place th= e > system under full load (~0.0% idle) the problem *disappears* and > playback/responsiveness are smooth and quick. >=20 > Running ktrace on some of the affected apps points me at the problem: > huge variance in the amount of time spent in the nanosleep system call.= > A sleep of, say, 5ms might take anywhere from 5ms to ~500ms from entry > to return of the syscall. OTOH, anything CPU-bound or that waits on > condvars or I/O interrupts seems to work fine, so this doesn't seem to > be an issue with overall system latency. >=20 > I can repro this with a simple program that just does a 3ms usleep in a= > tight loop (i.e. roughly the amount of time a video player would sleep > between frames @ 30fps). At light load ktrace will show the huge > nanosleep variance; under heavy load every nanosleep will complete in > almost exactly 3ms. >=20 > FWIW, I don't see this on -current, although right now all my -current > images are VMs on different HW so that might not mean anything. I'm no= t > aware of any recent timer- or scheduler- specific changes, so I'm > wondering if perhaps the recent IPI or taskqueue changes might be > somehow to blame. >=20 > I'm not especially familiar w/ the relevant parts of the kernel, so any= > guidance on where I should focus my debugging efforts would be much > appreciated. >=20 > Thanks, > Jason >=20 --CwVNp2n6VHORNLW5VDPT3ugoQViEouw1S-- --HDJ66P9oeeKbWwFf87EVABbhlNgJwSWjQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQF8BAEBCgBmBQJYGQkpXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRENkY3MTQyREU0MTU4MTgyRkZDNUU2ODVC QjlGOEJGOTkyODQxRDFCAAoJELufi/mShB0bC1sH/3wywXoqkh+fmPZZL8D3TZlc L5jH7AOdQyy7AB+KDhEeJqxalA/yGulquLC9gqaDLDheKjEJf7SCCzgsZ/s9lzh0 cC705ux+kUkGOhHAtOG+r0OVMmw1PMPJrlkg67OC9qUVKs2sG45BVinl5fB0CJWG J7VfkI3471mnozkLUrwpox/R5g2mjPOI/f8XzXLxyiYz9Fuc+jFNREoqdCPv5aco VhHY7Pg2Wif11A77LrG+C/5l5EjUcATgBlKhhj1FLe47UPlUucy25k9Fk71zqrKJ SEx6aiSUX8xY7VjNi5mjv7YlYUTRJIxaFUGEMqRUYwFvmihdOOUpGCiDMQOis0M= =Y9p7 -----END PGP SIGNATURE----- --HDJ66P9oeeKbWwFf87EVABbhlNgJwSWjQ--