Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Sep 2014 15:30:57 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r271195 - stable/9/sys/kern
Message-ID:  <201409061530.s86FUvCl059859@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Sep  6 15:30:57 2014
New Revision: 271195
URL: http://svnweb.freebsd.org/changeset/base/271195

Log:
  MFC r270423:
  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

Modified:
  stable/9/sys/kern/sched_4bsd.c
  stable/9/sys/kern/sched_ule.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/kern/sched_4bsd.c
==============================================================================
--- stable/9/sys/kern/sched_4bsd.c	Sat Sep  6 15:26:38 2014	(r271194)
+++ stable/9/sys/kern/sched_4bsd.c	Sat Sep  6 15:30:57 2014	(r271195)
@@ -983,7 +983,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: stable/9/sys/kern/sched_ule.c
==============================================================================
--- stable/9/sys/kern/sched_ule.c	Sat Sep  6 15:26:38 2014	(r271194)
+++ stable/9/sys/kern/sched_ule.c	Sat Sep  6 15:30:57 2014	(r271195)
@@ -1830,7 +1830,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?201409061530.s86FUvCl059859>