Re: [PATCH v2] net_sched: sch_sfq: fix allot handling

Eric Dumazet
2010-12-16T13:08:57Z

Le mercredi 15 décembre 2010 à 18:03 +0100, Patrick McHardy a écrit :
> On 15.12.2010 17:55, Eric Dumazet wrote:

> > I was thinking in allowing more packets per SFQ (but keep the 126 active
> > flows limit), what do you think ?
>
> I keep forgetting why this limit exists, let me try to figure
> it out once more :)

I took a look, and found we already are at max, unless we change
sfq_index type (from u8 to u16)

SFQ_SLOTS is 128 (not really exist, but this is the number of slots)
SFQ_DEPTH is 128 (max depth for one slot)
Constraints are :
SFQ_SLOTS < 256
SFQ_DEPTH < 256
SFQ_SLOTS + SFQ_DEPTH < 256, because of the dep[] array.

We could avoid the "struct sk_buff_head" structure with its un-needed
spinlock, and eventually group data for a given slot in a structure to
reduce number of cache lines we touch...

struct sfq_slot {
struct sk_buff *first;
struct sk_buff *last;
u8 qlen;
sfq_index next; /* dequeue chain */
u16 hash;
short allot;
/* 16bit hole */
};

This would save 768 bytes on x86_64 (and much more if LOCKDEP is used)