Date: Sat, 23 Aug 2014 17:31:56 +0000 (UTC) From: Alexander Motin <mav@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r270423 - head/sys/kern Message-ID: <201408231731.s7NHVuoX042435@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Sat Aug 23 17:31:56 2014 New Revision: 270423 URL: http://svnweb.freebsd.org/changeset/base/270423 Log: Restore pre-r239157 handling of sched_yield(), when thread time slice was aborted, allowing other threads to run. Without this change thread is just rescheduled again, that was illustrated by provided test tool. PR: 192926 Submitted by: eric@vangyzen.net MFC after: 2 weeks Modified: head/sys/kern/sched_4bsd.c head/sys/kern/sched_ule.c Modified: head/sys/kern/sched_4bsd.c ============================================================================== --- head/sys/kern/sched_4bsd.c Sat Aug 23 17:19:21 2014 (r270422) +++ head/sys/kern/sched_4bsd.c Sat Aug 23 17:31:56 2014 (r270423) @@ -982,7 +982,8 @@ sched_switch(struct thread *td, struct t sched_load_rem(); td->td_lastcpu = td->td_oncpu; - preempted = !(td->td_flags & TDF_SLICEEND); + preempted = !((td->td_flags & TDF_SLICEEND) || + (flags & SWT_RELINQUISH)); td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; td->td_oncpu = NOCPU; Modified: head/sys/kern/sched_ule.c ============================================================================== --- head/sys/kern/sched_ule.c Sat Aug 23 17:19:21 2014 (r270422) +++ head/sys/kern/sched_ule.c Sat Aug 23 17:31:56 2014 (r270423) @@ -1857,7 +1857,8 @@ sched_switch(struct thread *td, struct t ts->ts_rltick = ticks; td->td_lastcpu = td->td_oncpu; td->td_oncpu = NOCPU; - preempted = !(td->td_flags & TDF_SLICEEND); + preempted = !((td->td_flags & TDF_SLICEEND) || + (flags & SWT_RELINQUISH)); td->td_flags &= ~(TDF_NEEDRESCHED | TDF_SLICEEND); td->td_owepreempt = 0; if (!TD_IS_IDLETHREAD(td))
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201408231731.s7NHVuoX042435>