* [Cake] cake_heap* could use some comments
@ 2017-12-02 4:36 Dave Taht
2017-12-02 7:57 ` Jonathan Morton
0 siblings, 1 reply; 2+ messages in thread
From: Dave Taht @ 2017-12-02 4:36 UTC (permalink / raw)
To: Cake List
1) Cake_heap* functions could use a set of explanatory comments.
In cake_heapify especially:
1a) m, mb, l are really not self explanatory. "major". "major byte". "lost"?
r is right? l is left? a is CAKE_MAX_HEAP.
2) What's the operating principle of the overflow_timeout?
3) Why the divide by 2 here:
static unsigned int cake_drop(struct Qdisc *sch, struct sk_buff **to_free)
{
struct cake_sched_data *q = qdisc_priv(sch);
struct sk_buff *skb;
u32 idx = 0, tin = 0, len;
struct cake_tin_data *b;
struct cake_flow *flow;
struct cake_heap_entry qq;
u64 now = cobalt_get_time();
if (!q->overflow_timeout) {
int i;
/* Build fresh max-heap */
for (i = CAKE_MAX_TINS * CAKE_QUEUES / 2; i >= 0; i--)
cake_heapify(q, i);
//
--
Dave Täht
CEO, TekLibre, LLC
http://www.teklibre.com
Tel: 1-669-226-2619
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Cake] cake_heap* could use some comments
2017-12-02 4:36 [Cake] cake_heap* could use some comments Dave Taht
@ 2017-12-02 7:57 ` Jonathan Morton
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Morton @ 2017-12-02 7:57 UTC (permalink / raw)
To: Dave Taht; +Cc: Cake List
[-- Attachment #1: Type: text/plain, Size: 363 bytes --]
These are standard heap algorithms whose operation should be easily
recognisable. The build loop runs over the set of non-leaf nodes,
implicitly accessing both children which are automatically at double the
index.
The timeout is simply there to elide the overhead of maintaining the heap
when hard dropping hasn't been necessary for a while.
- Jonathan Morton
[-- Attachment #2: Type: text/html, Size: 427 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-12-02 7:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-02 4:36 [Cake] cake_heap* could use some comments Dave Taht
2017-12-02 7:57 ` Jonathan Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox