svn commit: r247783 - in head/sys: kern sys

Davide Italiano davide at FreeBSD.org
Mon Mar 4 11:51:47 UTC 2013


Author: davide
Date: Mon Mar  4 11:51:46 2013
New Revision: 247783
URL: http://svnweb.freebsd.org/changeset/base/247783

Log:
  MFcalloutng:
  Convert sleepqueue(9) bits to the new callout KPI. Take advantage of
  the possibility to run callback directly from hw interrupt context.
  
  Sponsored by:	Google Summer of Code 2012, iXsystems inc.
  Tested by:	flo, marius, ian, markj, Fabian Keil

Modified:
  head/sys/kern/subr_sleepqueue.c
  head/sys/sys/sleepqueue.h

Modified: head/sys/kern/subr_sleepqueue.c
==============================================================================
--- head/sys/kern/subr_sleepqueue.c	Mon Mar  4 11:43:20 2013	(r247782)
+++ head/sys/kern/subr_sleepqueue.c	Mon Mar  4 11:51:46 2013	(r247783)
@@ -361,7 +361,8 @@ sleepq_add(void *wchan, struct lock_obje
  * sleep queue after timo ticks if the thread has not already been awakened.
  */
 void
-sleepq_set_timeout(void *wchan, int timo)
+sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt, sbintime_t pr,
+    int flags)
 {
 	struct sleepqueue_chain *sc;
 	struct thread *td;
@@ -372,7 +373,8 @@ sleepq_set_timeout(void *wchan, int timo
 	MPASS(TD_ON_SLEEPQ(td));
 	MPASS(td->td_sleepqueue == NULL);
 	MPASS(wchan != NULL);
-	callout_reset_curcpu(&td->td_slpcallout, timo, sleepq_timeout, td);
+	callout_reset_sbt_on(&td->td_slpcallout, sbt, pr,
+	    sleepq_timeout, td, PCPU_GET(cpuid), flags | C_DIRECT_EXEC);
 }
 
 /*

Modified: head/sys/sys/sleepqueue.h
==============================================================================
--- head/sys/sys/sleepqueue.h	Mon Mar  4 11:43:20 2013	(r247782)
+++ head/sys/sys/sleepqueue.h	Mon Mar  4 11:51:46 2013	(r247783)
@@ -108,7 +108,10 @@ struct sleepqueue *sleepq_lookup(void *w
 void	sleepq_release(void *wchan);
 void	sleepq_remove(struct thread *td, void *wchan);
 int	sleepq_signal(void *wchan, int flags, int pri, int queue);
-void	sleepq_set_timeout(void *wchan, int timo);
+void	sleepq_set_timeout_sbt(void *wchan, sbintime_t sbt,
+	    sbintime_t pr, int flags);
+#define	sleepq_set_timeout(wchan, timo)					\
+    sleepq_set_timeout_sbt((wchan), (tick_sbt * (timo)), 0, C_HARDCLOCK)
 u_int	sleepq_sleepcnt(void *wchan, int queue);
 int	sleepq_timedwait(void *wchan, int pri);
 int	sleepq_timedwait_sig(void *wchan, int pri);


More information about the svn-src-all mailing list