Author: davide
Date: Mon Mar 25 09:43:50 2013
New Revision: 248699
URL: http://svnweb.freebsd.org/changeset/base/248699

Log:
  Cache the callout precision argument as part of the informations required
  for migrating callouts to new CPU. This value is passed to
  callout_cc_add() in order to update properly precision field in case of
  rescheduling/migration.
  
  Reviewed by:  mav

Modified:
  head/sys/kern/kern_timeout.c

Modified: head/sys/kern/kern_timeout.c
==============================================================================
--- head/sys/kern/kern_timeout.c        Mon Mar 25 08:50:51 2013        
(r248698)
+++ head/sys/kern/kern_timeout.c        Mon Mar 25 09:43:50 2013        
(r248699)
@@ -131,6 +131,7 @@ struct cc_exec {
        void                    *ce_migration_arg;
        int                     ce_migration_cpu;
        sbintime_t              ce_migration_time;
+       sbintime_t              ce_migration_prec;
 #endif
        bool                    cc_cancel;
        bool                    cc_waiting;
@@ -167,10 +168,12 @@ struct callout_cpu {
 #define        cc_migration_arg        cc_exec_entity[0].ce_migration_arg
 #define        cc_migration_cpu        cc_exec_entity[0].ce_migration_cpu
 #define        cc_migration_time       cc_exec_entity[0].ce_migration_time
+#define        cc_migration_prec       cc_exec_entity[0].ce_migration_prec
 #define        cc_migration_func_dir   cc_exec_entity[1].ce_migration_func
 #define        cc_migration_arg_dir    cc_exec_entity[1].ce_migration_arg
 #define        cc_migration_cpu_dir    cc_exec_entity[1].ce_migration_cpu
 #define        cc_migration_time_dir   cc_exec_entity[1].ce_migration_time
+#define        cc_migration_prec_dir   cc_exec_entity[1].ce_migration_prec
 
 struct callout_cpu cc_cpu[MAXCPU];
 #define        CPUBLOCK        MAXCPU
@@ -227,6 +230,7 @@ cc_cce_cleanup(struct callout_cpu *cc, i
 #ifdef SMP
        cc->cc_exec_entity[direct].ce_migration_cpu = CPUBLOCK;
        cc->cc_exec_entity[direct].ce_migration_time = 0;
+       cc->cc_exec_entity[direct].ce_migration_prec = 0;
        cc->cc_exec_entity[direct].ce_migration_func = NULL;
        cc->cc_exec_entity[direct].ce_migration_arg = NULL;
 #endif
@@ -605,7 +609,7 @@ softclock_call_cc(struct callout *c, str
        void (*new_func)(void *);
        void *new_arg;
        int flags, new_cpu;
-       sbintime_t new_time;
+       sbintime_t new_prec, new_time;
 #endif
 #if defined(DIAGNOSTIC) || defined(CALLOUT_PROFILING) 
        sbintime_t sbt1, sbt2;
@@ -721,6 +725,7 @@ skip:
                 */
                new_cpu = cc->cc_exec_entity[direct].ce_migration_cpu;
                new_time = cc->cc_exec_entity[direct].ce_migration_time;
+               new_prec = cc->cc_exec_entity[direct].ce_migration_prec;
                new_func = cc->cc_exec_entity[direct].ce_migration_func;
                new_arg = cc->cc_exec_entity[direct].ce_migration_arg;
                cc_cce_cleanup(cc, direct);
@@ -742,7 +747,7 @@ skip:
 
                new_cc = callout_cpu_switch(c, cc, new_cpu);
                flags = (direct) ? C_DIRECT_EXEC : 0;
-               callout_cc_add(c, new_cc, new_time, c->c_precision, new_func,
+               callout_cc_add(c, new_cc, new_time, new_prec, new_func,
                    new_arg, new_cpu, flags);
                CC_UNLOCK(new_cc);
                CC_LOCK(cc);
@@ -996,6 +1001,8 @@ callout_reset_sbt_on(struct callout *c, 
                        cc->cc_exec_entity[direct].ce_migration_cpu = cpu;
                        cc->cc_exec_entity[direct].ce_migration_time
                            = to_sbt;
+                       cc->cc_exec_entity[direct].ce_migration_prec 
+                           = precision;
                        cc->cc_exec_entity[direct].ce_migration_func = ftn;
                        cc->cc_exec_entity[direct].ce_migration_arg = arg;
                        c->c_flags |= CALLOUT_DFRMIGRATION;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to