From owner-svn-src-head@freebsd.org Mon Oct 22 10:27:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05FB2FF32F5; Mon, 22 Oct 2018 10:27:20 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 633C57316B; Mon, 22 Oct 2018 10:27:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [178.17.145.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 78C75260174; Mon, 22 Oct 2018 12:27:17 +0200 (CEST) Subject: Re: svn commit: r339582 - head/sys/dev/sound/midi To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201810220858.w9M8wSBZ039042@repo.freebsd.org> <20181022095131.GN5335@kib.kiev.ua> <20181022102016.GO5335@kib.kiev.ua> From: Hans Petter Selasky Message-ID: Date: Mon, 22 Oct 2018 12:26:46 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.0.1 MIME-Version: 1.0 In-Reply-To: <20181022102016.GO5335@kib.kiev.ua> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Oct 2018 10:27:20 -0000 On 10/22/18 12:20 PM, Konstantin Belousov wrote: > Then why do you need to re-acquire the mutex after uiomove ? Hi, Because the code is factored this way: mtx_lock(); while (uio->uio_resid > 0) { do state checks() mtx_unlock(); retval = uiomove(); mtx_lock(); } mtx_unlock(); Yes, you're right the last mtx_lock() can be optimised away. I'm leaving that to somebody else. This code typically is processing MIDI events at very slow rates like 8KBytes/s and does not need to be very fast. --HPS