]> git.puffer.fish Git - mirror/frr.git/commitdiff
[lib/workqueue] remove the useless 'delay' factor.
authorpaul <paul>
Thu, 2 Feb 2006 17:50:19 +0000 (17:50 +0000)
committerpaul <paul>
Thu, 2 Feb 2006 17:50:19 +0000 (17:50 +0000)
2006-02-02 Paul Jakma <paul.jakma@sun.com>

* workqueue.h: (struct work_queue) Remove the delay field.
  It served no purpose and just introduced bad behaviour.
  Should be excised before its allowed to escape into 1.0.
  This removes need for the 'flood' and runs_since_clear
  fields.
* workqueue.c: (general) excise delay factor between queue
  runs, hence the 'flood' crap too.. See above.
* bgp_route.c: (bgp_{clear_node,process}_queue_init) delay
  field is removed from workqueue spec.

bgpd/ChangeLog
bgpd/bgp_route.c
lib/ChangeLog
lib/workqueue.c
lib/workqueue.h

index c96bc649c64d9f276c20b18ae72a51ce7f2262b8..714de1d30151123d1ffc9300086f162c116e15c3 100644 (file)
@@ -1,3 +1,8 @@
+2006-02-02 Paul Jakma <paul.jakma@sun.com>
+
+       * bgp_route.c: (bgp_{clear_node,process}_queue_init) delay
+         field is removed from workqueue spec.
+
 2006-01-19 Paul Jakma <paul.jakma@sun.com>
 
        * (general) various miscellaneous compiler warning fixes.
index e0d2a317fd9fcd061c5fef51b944d71601fb1e6a..3d9856b9910818c8ba710d5cdbdf222c7ff7879b 100644 (file)
@@ -1423,8 +1423,6 @@ bgp_process_queue_init (void)
     = bm->process_main_queue->spec.max_retries = 0;
   bm->process_rsclient_queue->spec.hold
     = bm->process_main_queue->spec.hold = 500;
-  bm->process_rsclient_queue->spec.delay
-    = bm->process_main_queue->spec.delay = 10;
 }
 
 void
@@ -2526,7 +2524,6 @@ bgp_clear_node_queue_init (void)
       exit (1);
     }
   bm->clear_node_queue->spec.hold = 10;
-  bm->clear_node_queue->spec.delay = 0; /* no gathering to be gained */
   bm->clear_node_queue->spec.workfunc = &bgp_clear_route_node;
   bm->clear_node_queue->spec.del_item_data = &bgp_clear_node_queue_del;
   bm->clear_node_queue->spec.completion_func = &bgp_clear_node_complete;
index 600ffef7fc9a08cfd98c493d803c7dd5c6a2504c..6c54cd359989356bb6333b3057da776a81a41adb 100644 (file)
@@ -1,3 +1,13 @@
+2006-02-02 Paul Jakma <paul.jakma@sun.com>
+
+       * workqueue.h: (struct work_queue) Remove the delay field.
+         It served no purpose and just introduced bad behaviour.
+         Should be excised before its allowed to escape into 1.0.
+         This removes need for the 'flood' and runs_since_clear
+         fields.
+       * workqueue.c: (general) excise delay factor between queue
+         runs, hence the 'flood' crap too.. See above.
+
 2006-01-19 Paul Jakma <paul.jakma@sun.com>
 
        * stream.c: (stream_getq_from) should use POSIX uint64_t
index 0c61f5c4f6a1524aa89029a7011958bef29dcb15..1fa16dedbc6c44c355ae7db77738c7d30c9dcb03 100644 (file)
@@ -82,9 +82,7 @@ work_queue_new (struct thread_master *m, const char *queue_name)
   new->cycles.granularity = WORK_QUEUE_MIN_GRANULARITY;
 
   /* Default values, can be overriden by caller */
-  new->spec.delay = WORK_QUEUE_DEFAULT_DELAY;
   new->spec.hold = WORK_QUEUE_DEFAULT_HOLD;
-  new->spec.flood = WORK_QUEUE_DEFAULT_FLOOD;
     
   return new;
 }
@@ -133,7 +131,7 @@ work_queue_add (struct work_queue *wq, void *data)
   item->data = data;
   listnode_add (wq->items, item);
   
-  work_queue_schedule (wq, wq->spec.delay);
+  work_queue_schedule (wq, wq->spec.hold);
   
   return;
 }
@@ -172,14 +170,14 @@ DEFUN(show_work_queues,
   struct work_queue *wq;
   
   vty_out (vty, 
-           "%c%c %8s %11s %8s %21s%s",
-           ' ', ' ', "List","(ms)   ","Q. Runs","Cycle Counts   ",
+           "%c %8s %5s %8s %21s%s",
+           ' ', "List","(ms) ","Q. Runs","Cycle Counts   ",
            VTY_NEWLINE);
   vty_out (vty,
-           "%c%c %8s %5s %5s %8s %7s %6s %6s %s%s",
-           'P', 'F',
+           "%c %8s %5s %8s %7s %6s %6s %s%s",
+           'P',
            "Items",
-           "Delay","Hold",
+           "Hold",
            "Total",
            "Best","Gran.","Avg.", 
            "Name", 
@@ -187,11 +185,10 @@ DEFUN(show_work_queues,
  
   for (ALL_LIST_ELEMENTS_RO ((&work_queues), node, wq))
     {
-      vty_out (vty,"%c%c %8d %5d %5d %8ld %7d %6d %6u %s%s",
+      vty_out (vty,"%c %8d %5d %8ld %7d %6d %6u %s%s",
                (wq->flags == WQ_PLUGGED ? 'P' : ' '),
-               (wq->runs_since_clear >= wq->spec.flood ? 'F' : ' '),
                listcount (wq->items),
-               wq->spec.delay, wq->spec.hold,
+               wq->spec.hold,
                wq->runs,
                wq->cycles.best, wq->cycles.granularity,
                  (wq->runs) ? 
@@ -226,7 +223,7 @@ work_queue_unplug (struct work_queue *wq)
   wq->flags = WQ_UNPLUGGED;
 
   /* if thread isnt already waiting, add one */
-  work_queue_schedule (wq, wq->spec.delay);
+  work_queue_schedule (wq, wq->spec.hold);
 }
 
 /* timer thread to process a work queue
@@ -370,19 +367,9 @@ stats:
   
   /* Is the queue done yet? If it is, call the completion callback. */
   if (listcount (wq->items) > 0)
-    {
-      if (++(wq->runs_since_clear) < wq->spec.flood)
-        work_queue_schedule (wq, wq->spec.hold);
-      else
-        work_queue_schedule (wq, 0); /* queue flooded, go into overdrive */
-    }
-  else
-    {
-      wq->runs_since_clear = 0;
-      
-      if (wq->spec.completion_func)
-        wq->spec.completion_func (wq);
-    }
+    work_queue_schedule (wq, 0);
+  else if (wq->spec.completion_func)
+    wq->spec.completion_func (wq);
   
   return 0;
 }
index 0a398ded3f12f7ddf5f998c8c80cc0a65fd18ea9..c06f481fed9dab97e47f37c6bd37a7a901cac04b 100644 (file)
 #ifndef _QUAGGA_WORK_QUEUE_H
 #define _QUAGGA_WORK_QUEUE_H
 
-/* Work queue default hold and cycle times - millisec */
-#define WORK_QUEUE_DEFAULT_HOLD  50  /* hold-time between runs of a queue */
-#define WORK_QUEUE_DEFAULT_DELAY 10  /* minimum delay for queue runs */
-#define WORK_QUEUE_DEFAULT_FLOOD 40   /* flood factor, ~2s with prev values */
+/* Hold time for the initial schedule of a queue run, in  millisec */
+#define WORK_QUEUE_DEFAULT_HOLD  50 
 
 /* action value, for use by item processor and item error handlers */
 typedef enum
@@ -90,25 +88,11 @@ struct work_queue
     unsigned int max_retries;  
 
     unsigned int hold; /* hold time for first run, in ms */
-    unsigned int delay; /* min delay between queue runs, in ms */
-    
-    unsigned int flood; /* number of queue runs after which we consider
-                         * queue to be flooded, where the runs are
-                         * consecutive and each has used its full slot,
-                         * and the queue has still not been cleared. If
-                         * the queue is flooded, then we try harder to
-                         * clear it by ignoring the hold and delay
-                         * times. No point sparing CPU resources just
-                         * to use ever more memory resources.
-                         */
   } spec;
   
   /* remaining fields should be opaque to users */
   struct list *items;                 /* queue item list */
   unsigned long runs;                 /* runs count */
-  unsigned int runs_since_clear;      /* number of runs since queue was
-                                       * last cleared
-                                       */
   
   struct {
     unsigned int best;