From owner-freebsd-stable@freebsd.org Tue Nov 1 21:29:18 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 E1BDCC2AB3A for ; Tue, 1 Nov 2016 21:29:18 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-pf0-x233.google.com (mail-pf0-x233.google.com [IPv6:2607:f8b0:400e:c00::233]) (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 553111C85 for ; Tue, 1 Nov 2016 21:29:18 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-pf0-x233.google.com with SMTP id i88so7814915pfk.2 for ; Tue, 01 Nov 2016 14:29:18 -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=JIb1m1Y56ATF8VNY/9+w+JlgHW5kapr2ZzSLFL8jaAs=; b=WdZQvDZCYw8rmbAtqI9dCAoLp2rTLzVu5GiWra8jCOVa9R/CKkV1FgB6+iaGJnaSa7 oVbh4GqrF6OH7jOdB8eiZmREaOFlKU7XDbFsBFMjytNPfZlhVglobrx2JN7LRRnyNxde yQUrp3VhS1DaZxWwF7N/kVGI4CpCIISq1J861io/UBnzkTzmmMALtotdOkJ7kCdvjimd OvUeFdxWnURYr3RXNG49nKzn3tARKnZTXuvu2HAql1YE/55B4QVyKlsXq99Uk1CzER2x udmsYwQ2MSUpqfyNfagJ+7lpNehprhwN+fQa4jFOyP26yNXC4ITHzlTS9EMql+sEEabI e1AQ== 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=JIb1m1Y56ATF8VNY/9+w+JlgHW5kapr2ZzSLFL8jaAs=; b=QhUMiM0hYTtofH/QhpMgsXDyqDdy8AO5OF4rrb9DuXumDNpKoak04TloVgeIUTCgF+ 0T7+t0SzgbYVKkofo/K/JTWptkWnznRWeL/ioUIwBE4/FWuaYJzx6yiaIsWQd8RmHP0z 4c/fJb4JRIfklL6tJA2ZG7NK9DOPe7Q5Jvm3Qell6HW4RkdO5VcQKHcMmp98E7wFCaFH vmcJ4GT0FHLvMOmO+JJ+Jis+dVkIY/9AxXlQFdx/zaAFQTt7rqhZXI96lR24WaIR6nRI GQr9BxAcwtdEj0kNxcEoaWJWpJER2oSCI1dXQtTJkrZw3W2V3cPuBMug0EXkgJ6ZhiZr 4NIw== X-Gm-Message-State: ABUngveRsFJovbpRFnf/kJg1WNQlUi4uSfkF2Eb2NjrIGH6IoPW0f6j8TohVYLgxPZB31g== X-Received: by 10.99.117.71 with SMTP id f7mr146795pgn.61.1478035757412; Tue, 01 Nov 2016 14:29:17 -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 k67sm20922415pfj.47.2016.11.01.14.29.16 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 14:29:16 -0700 (PDT) Subject: Re: huge nanosleep variance on 11-stable To: freebsd-stable@freebsd.org References: <6167392c-c37a-6e39-aa22-ca45435d6088@gmail.com> From: Jason Harmening Message-ID: <1c3f4599-8aef-471a-3a39-49d913f1a4e5@gmail.com> Date: Tue, 1 Nov 2016 14:36:16 -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: <6167392c-c37a-6e39-aa22-ca45435d6088@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="FeuPRo8Cg75vjqIn3oKdVcFOPkLFb2xpo" 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:29:19 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FeuPRo8Cg75vjqIn3oKdVcFOPkLFb2xpo Content-Type: multipart/mixed; boundary="mwOsF42V3L8V2Klv3dae7EWcGXsbMLrLM"; protected-headers="v1" From: Jason Harmening To: freebsd-stable@freebsd.org Message-ID: <1c3f4599-8aef-471a-3a39-49d913f1a4e5@gmail.com> Subject: Re: huge nanosleep variance on 11-stable References: <6167392c-c37a-6e39-aa22-ca45435d6088@gmail.com> In-Reply-To: <6167392c-c37a-6e39-aa22-ca45435d6088@gmail.com> --mwOsF42V3L8V2Klv3dae7EWcGXsbMLrLM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sorry, that should be ~*30ms* to get 30fps, though the variance is still up to 500ms for me either way. On 11/01/16 14:29, Jason Harmening wrote: > repro code is at http://pastebin.com/B68N4AFY if anyone's interested. >=20 > On 11/01/16 13:58, Jason Harmening wrote: >> Hi everyone, >> >> 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. >> >> The system is under very light load, and I see no evidence of abnormal= >> interrupt latency or interrupt load. More interestingly, if I place t= he >> system under full load (~0.0% idle) the problem *disappears* and >> playback/responsiveness are smooth and quick. >> >> 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= =2E >> 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. >> >> 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. >> >> 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 n= ot >> 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. >> >> I'm not especially familiar w/ the relevant parts of the kernel, so an= y >> guidance on where I should focus my debugging efforts would be much >> appreciated. >> >> Thanks, >> Jason >> >=20 --mwOsF42V3L8V2Klv3dae7EWcGXsbMLrLM-- --FeuPRo8Cg75vjqIn3oKdVcFOPkLFb2xpo Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQF8BAEBCgBmBQJYGQrQXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRENkY3MTQyREU0MTU4MTgyRkZDNUU2ODVC QjlGOEJGOTkyODQxRDFCAAoJELufi/mShB0bIVIIAJWGV1HTR4Q3MjmSKYRmpOd9 VwdriZdNHlP+R6SvjPdxhG2JsAvQsOUvg7UZEu7Or08/JM/SMQOuFL+pXGwHcqE2 e0tl5IDMQHr6JrLweyBiI+td8FuPxqHMDFWm1rsUg6YUkWCEfNYu30vp0Lpuvy6v wn80K0vdBqiLRW60gZsA9KVwt/4TK7VCdgDY/6IajrGLzsxhPcvdGTZA+6QkGf5r WIJfHzXwSm+h4a2hHzpRRSRh2RjalDmgF1yUtuxTmV/NOsuI8SpcT+11zos2jlN6 XmtLcDtgboY8h9rAVQMBibyzsCatQ5fmv443B/TEcgG5DSGfKGjMVXyW4Fqrcew= =z3t/ -----END PGP SIGNATURE----- --FeuPRo8Cg75vjqIn3oKdVcFOPkLFb2xpo--