From owner-freebsd-stable@freebsd.org Tue Nov 1 20:51:57 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 537DFC2AD35 for ; Tue, 1 Nov 2016 20:51:57 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: from mail-pf0-x22b.google.com (mail-pf0-x22b.google.com [IPv6:2607:f8b0:400e:c00::22b]) (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 EEADD15C7 for ; Tue, 1 Nov 2016 20:51:56 +0000 (UTC) (envelope-from jason.harmening@gmail.com) Received: by mail-pf0-x22b.google.com with SMTP id 189so47405740pfz.3 for ; Tue, 01 Nov 2016 13:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:from:subject:message-id:date:user-agent:mime-version; bh=fgt9gwKI4lRGZ59iknJK/ZCung5Q7EsInscS+5Eb2Z0=; b=eky6sd8drPCFQLVfx4fAiS3Tiel/IY6hNK5MG7sTg9u41wTV0kDmODA1EoF+OSbQ2X RTn6Ba2RQQVukOC7Gz8cvqFiIiMLT5F0uadqW/k9eCOXYJvWeqtbNYj1cTUaQ5namcri rabbeJQnD5WiqbFCKxKmBFR8viJ5mFE8GzDddO5BLltZATas+3WDQiYYIT7g1ltA1+7g iNOjjUnbKUs7egz2E5tbG0fDRFb5YGLR32kaNtF/VBpkoLe8HVcLHxFgsDitCTwFTYMv nXejMw3lR/4Omc5rV+eylyKpmkh4lsWY2PZIyDjudFLHpKIqgC7ZvYLeS6dnm2A3dtjS rCFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version; bh=fgt9gwKI4lRGZ59iknJK/ZCung5Q7EsInscS+5Eb2Z0=; b=lu5DonhHE55dbba+noZ5mFjrAPIfEqQyV20VNzOIjn1+2QzgjWCzEtE0CVcJeLGpS9 SiyIV4jjZysRPYtqNcjUonZxYxvZDFGSWHafNOWFESJDLGOgPFwMuz6bioZcBBF72mO5 g34Nl5bSiDR+KsLvjoO4pI3QsrAU64a/XTdoUX1/BgVTdGkwXlUX2VWSxvquFZTVvRh2 +w57yUzXy5CEE4j213YxMoJ/Pk85r6v7ettZMEI+FXlknTcrOrKbiyWxrliudJlYLspR rS3XBbq7f5rrmJiggkP4yU8NjLtuwML4ebp8ZwZ+O2oD8eBSsBO3RoGPbTyuHJx5JoO0 nJJw== X-Gm-Message-State: ABUngvf9W4Q608nbrB3lHzkT0wyWYsXBeuCPlgnnZSU5rKQRLvY7BsxgZH4toq3shcODsQ== X-Received: by 10.99.98.2 with SMTP id w2mr51979951pgb.59.1478033516045; Tue, 01 Nov 2016 13:51:56 -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 w15sm44123693pfi.55.2016.11.01.13.51.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Nov 2016 13:51:54 -0700 (PDT) To: freebsd-stable@freebsd.org From: Jason Harmening Subject: huge nanosleep variance on 11-stable Message-ID: Date: Tue, 1 Nov 2016 13:58:53 -0700 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="A38r7Uo4OBWvgQ5M9aqooXw4kV9U9CR9I" 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 20:51:57 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --A38r7Uo4OBWvgQ5M9aqooXw4kV9U9CR9I Content-Type: multipart/mixed; boundary="LsAW7xxhbRV5jXDkQ8W8EX2K92PL5wtT6"; protected-headers="v1" From: Jason Harmening To: freebsd-stable@freebsd.org Message-ID: Subject: huge nanosleep variance on 11-stable --LsAW7xxhbRV5jXDkQ8W8EX2K92PL5wtT6 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 the 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. 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 not 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 any guidance on where I should focus my debugging efforts would be much appreciated. Thanks, Jason --LsAW7xxhbRV5jXDkQ8W8EX2K92PL5wtT6-- --A38r7Uo4OBWvgQ5M9aqooXw4kV9U9CR9I Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQF8BAEBCgBmBQJYGQIOXxSAAAAAAC4AKGlzc3Vlci1mcHJAbm90YXRpb25zLm9w ZW5wZ3AuZmlmdGhob3JzZW1hbi5uZXRENkY3MTQyREU0MTU4MTgyRkZDNUU2ODVC QjlGOEJGOTkyODQxRDFCAAoJELufi/mShB0bmzQH/jmKuVxn4Ug1TvlyWv38ThsS j0xDqygjghN5FT1HtOm8VXr+y67rXrPbfwcJrpBsaizUl3MHhGp9xaYdkcrH34Nt XfL1EtRjSMghf2pmAP1uiiOS4XWuQ9M2r4R0Kd0k9raftKfkn/DfDf/IQQ94i/ah FCzL/Bd9f2KaDzADc8sO0iZpSHIyCBB9uXKFXvWka3ahXaXg0drzBLnv1FJHl2N/ TYueOUlr0wYe6kygo7n4JJ2vA4uZP7lM9Z881j7zIlcGAkap9hcYqWYyflamCikY px4JfNtzXUgarhEIHevYrBnN31ulQSkIzqyPG5kV9B702R1J/mxuwvej3Kp8a4k= =E/vK -----END PGP SIGNATURE----- --A38r7Uo4OBWvgQ5M9aqooXw4kV9U9CR9I--