Subject: MINCLSIZE considered harmful
To: None <tech-net@NetBSD.org>
From: Matthias Scheler <tron@zhadum.de>
List: tech-net
Date: 08/24/2005 19:29:58
	Hello,

MINCLSIZE is current defined like this in "src/sys/sys/mbuf.h":

#define MINCLSIZE	(MHLEN+MLEN+1)	/* smallest amount to put in cluster */

Network code code paying attention to this value will therefore create
a chain of an mbuf packet header and a normal mbuf for certain payload
sizes instead of using a single mbuf cluster.

This seems to be bad at least for architectures which (usually) use DMA
capable NICs because the driver either has to use scatter gather or even
worse copy the data into a continuous buffer. I therefore wonder if we
should define MINCLSIZE to MHLEN instead on at least architectures
which are not terribly short on memory, e.g. NetBSD-amd64.

	Kind regards

-- 
Matthias Scheler                                  http://scheler.de/~matthias/