[Ntop-misc] why is PF_RING limited to only allocating up to 4MB
solutions_amit at hotmail.com
Tue Jun 27 00:53:25 CEST 2006
why is PF_RING limited to only allocating up to 4MB of ring slotsWell I do not know much about 2.6 kernels,
but a few observations which might be the cause-
1) The get free pages routine has non deterministic behavior, I mean its a best effort process, when I wanted to get very big chunks of contiguous blocks, the process failed because there wasnt any such bloocks left. however it runs ok for smaller chunks, its expected as bigger contiguos blocks may not be available at all,
2) There may be a limit programed in the process itself, because 4 Mb was the kernel memory limit for older kernels, though it should be taken care off if you enable larger memory support option during kernel compile.
and by the way you can use a different option to reduce memory requirement, try my posting on DMA ring, i wrote couple of papers on it and notified the user group about that approach, this approach cut down the memory requirement drasticaly and improved the performance on the other hand.
allocating big memory blocks might create problem to other processes or kernel activities, so should take care about it.
----- Original Message -----
From: Rob Willis
To: ntop-misc at listgateway.unipi.it
Sent: Monday, June 26, 2006 6:24 PM
Subject: [Ntop-misc] why is PF_RING limited to only allocating up to 4MB ofring slots
(Hopefully, this doesnt turn into a double post since I sent an earlier email via my home email account by accident).
I've been playing with PF_RING (with positive results). However it seems to be limited to only allocating enough slots up to 4MB of memory. I'm on FedoraCore4, 2.6.12.
I took a look at the RF_RING code and it is calling __get_free_pages(priority,order) where order represents the number of kernel memory pages to return: 2^order. So pages returned:
order=0: 1 page
order=1: 2 pages
order=2: 4 pages
And in my case, PF_RING decides on an order of 10:
order=10: 1024 pages
Since each page is 4kb, that means it returns 4 MB of memory for use as ring slots. My ring slot size is set to 1518 (just big enough for an 802.1q packet).
Anyways, even when I request 8MB or 16 MB, this function always returns 4 MB (ie it always uses an order of 10). Is there another option to get PF_RING to allocate more memory? I've got 8 GB on this system and need to do some fairly indepth analysis of packets. So would like to have a very large buffer allocated.
If there is some reason that __get_free_pages can only return 4 MB blocks, perhaps PF_RING could be reworked to manage multiple large blocks. Then could call __get_free_pages multiple times and put all of the blocks in a array. Would mean an extra level of indirection when referencing a ring slot, but that doesnt seem like that much more overhead.
I might even be willing to dive in and come up with a patch to do just that if someone told me that was even possible. And if they said there wasnt an easier way to get PF_RING to allocate more memory.
Ntop-misc mailing list
Ntop-misc at listgateway.unipi.it
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Ntop-misc