Re: td_swvoltick

2018-01-12 Thread Eric van Gyzen
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
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: td_swvoltick

2018-01-12 Thread Konstantin Belousov
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.

> 
> 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
> ___
> freebsd-current@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


td_swvoltick

2018-01-12 Thread Eric van Gyzen
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?

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
___
freebsd-current@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"