Kernel people tell me users should never need to know the value of HZ used by the currently running kernel. One kernel hacker even told me that Linus once changed the value from 100 to 1000 just to see user space programs break. However, it is needed for the buffer parameter in TBF. The tc-tbf(8) manpage: If your buffer is too small, packets may be dropped because more tokens arrive per timer tick than fit in your bucket. The mini- mum buffer size can be calculated by dividing the rate by HZ. My kernel (2.6.12), for example, doesn''t have a CONFIG option in /proc/config.gz. I only found out the correct HZ value by looking into /usr/include/asm/param.h, and even there are two values: 1000 for __KERNEL__ and 250 for the rest. Newer kernels have CONFIG options and 1000 is just one of the possible values. So, how do we reliably calculate the minimum value for buffer/burst/maxburts?
On Thu, Feb 23, 2006 at 05:21:46PM -0300, Andreas Hasenack wrote:> Kernel people tell me users should never need to know the value of HZ > used by the currently running kernel. One kernel hacker even told me > that Linus once changed the value from 100 to 1000 just to see user > space programs break.Hmmm. Don''t know the context of this statement, but from my (naive) point of view, TBF is not a user space program. The user space program is tc, and it just sets up structures in the kernel once. The shaping itself is done in kernel space.> So, how do we reliably calculate the minimum value for buffer/burst/maxburts?Trial & Error, not that I ever had much luck with TBF though... TBF doesn''t really depend on the HZ value - you don''t really need to know. Still, TBF is affected by the HZ, like many other parts of the kernel too. It can''t be helped - dunno what else to say about it. Regards Andreas Klauer
Em Qui 23 Fev 2006 19:47, Andreas Klauer escreveu:> > So, how do we reliably calculate the minimum value for > > buffer/burst/maxburts? > > Trial & Error, not that I ever had much luck with TBF though...From my experiments, the minimum seems to be either MTU plus a few bytes or the result of rate/HZ, whichever is higher.
Andreas Hasenack wrote:> Em Qui 23 Fev 2006 19:47, Andreas Klauer escreveu: > >>>So, how do we reliably calculate the minimum value for >>>buffer/burst/maxburts? >> >>Trial & Error, not that I ever had much luck with TBF though... > > > From my experiments, the minimum seems to be either MTU plus a few bytes or > the result of rate/HZ, whichever is higher.Both the buffers need to be at least MTU and if you shape on eth MTU+14. You should set the limit buffer to the length of queue you want - 1*MTU(+14) is pretty useless for a limit but OK for burst. I am not sure about tbf and Hz if it''s like htb you need to set burst big enough so its size * HZ can fill the link. Andy.