From owner-freebsd-current@freebsd.org Fri Jan 12 22:37:00 2018 Return-Path: Delivered-To: freebsd-current@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 0683CEA5534 for ; Fri, 12 Jan 2018 22:37:00 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from smtp.vangyzen.net (hotblack.vangyzen.net [199.48.133.146]) by mx1.freebsd.org (Postfix) with ESMTP id E51C884E92 for ; Fri, 12 Jan 2018 22:36:58 +0000 (UTC) (envelope-from eric@vangyzen.net) Received: from sweettea.beer.town (unknown [76.164.8.130]) by smtp.vangyzen.net (Postfix) with ESMTPSA id 8CD065646F; Fri, 12 Jan 2018 16:36:57 -0600 (CST) Subject: Re: td_swvoltick To: Konstantin Belousov Cc: FreeBSD Current References: <603d2786-86be-583c-9ff6-d8d73eddf77e@vangyzen.net> <20180112193659.GL1684@kib.kiev.ua> From: Eric van Gyzen Message-ID: Date: Fri, 12 Jan 2018 16:36:56 -0600 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20180112193659.GL1684@kib.kiev.ua> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Jan 2018 22:37:00 -0000 On 01/12/2018 13:36, Konstantin Belousov wrote: > On Fri, Jan 12, 2018 at 01:31:41PM -0600, Eric van Gyzen wrote: >> should_yield() compares thread::td_swvoltick to 'ticks' to determine >> whether a thread is hogging and should yield. Since td_swvoltick >> records 'ticks' /before/ the actual context switch, the calculation in >> should_yield() includes any time that the thread was switched out. It >> seems that should_yield() wants to know how long the thread has actually >> been running. Therefore, td_swvoltick should record 'ticks' /after/ >> sched_switch() returns. >> >> Does this make sense, or am I missing something? > Yes, it does make sense to me. Thanks, Kostik. If anyone else is interested: https://reviews.freebsd.org/D13892 >> >> If this makes sense, I would probably keep the current assignment in >> mi_switch() and simply add a second assignment after the call to >> sched_switch(). That way, db_show_thread will still show useful data >> for sleeping threads. I would do the same for td_swinvolticks. >> >> I'll be happy to make the change myself. I just want a sanity check >> before I bother. >> >> Thanks in advance, >> >> Eric