Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: NTop: Misc

ring_alloc_mem() in pf_ring kernel module

 

 

NTop misc RSS feed   Index | Next | Previous | View Threaded


jonathan.lynch at thenowfactory

May 10, 2011, 9:09 AM

Post #1 of 4 (636 views)
Permalink
ring_alloc_mem() in pf_ring kernel module

Hi Luca,

I was looking at the code in pfring kernel module function ring_alloc_mem()
to see how the module param min_num_slots impacts on the amount of memory
allocated for the ring.
I am wondering what the highlighted line below is doing. What alignment is
it looking to achieve? (it was added in revision 4400).

/* Alignment necessary on ARM platforms */
num_pages = tot_mem / PAGE_SIZE;
num_pages += (num_pages + (SHMLBA-1)) % SHMLBA;

On x86, SHMLBA is defined as PAGE_SIZE. On ARM SHMLBA it is defined as (4 *
PAGE_SIZE)

Regards
Jonathan


cardigliano at ntop

May 10, 2011, 9:27 AM

Post #2 of 4 (604 views)
Permalink
Re: ring_alloc_mem() in pf_ring kernel module [In reply to]

2011/5/10 Lynch, Jonathan <jonathan.lynch [at] thenowfactory>

> Hi Luca,
>
> I was looking at the code in pfring kernel module function ring_alloc_mem()
> to see how the module param min_num_slots impacts on the amount of memory
> allocated for the ring.
> I am wondering what the highlighted line below is doing. What alignment is
> it looking to achieve? (it was added in revision 4400).
>
> /* Alignment necessary on ARM platforms */
> num_pages = tot_mem / PAGE_SIZE;
> num_pages += (num_pages + (SHMLBA-1)) % SHMLBA;
>
> On x86, SHMLBA is defined as PAGE_SIZE. On ARM SHMLBA it is defined as (4
> * PAGE_SIZE)
>

SHMLBA is a multiple needed in some architectures with virtually indexed L1
caches, which suffer from aliasing problems, to make virtual aliases
coherent

Best Regards
Alfredo


jonathan.lynch at thenowfactory

May 11, 2011, 9:05 AM

Post #3 of 4 (589 views)
Permalink
Re: ring_alloc_mem() in pf_ring kernel module [In reply to]

Is this something that could be put inside a ARCH define and just set for
the relevant architectures?

Does this functionality added to vmalloc_user() in kernel 2.6.32 provide the
alignment necessary?
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2dca6999eed58d44b67e9de7d6ec230f6250553d

On 10 May 2011 17:27, Alfredo Cardigliano <cardigliano [at] ntop> wrote:

>
> 2011/5/10 Lynch, Jonathan <jonathan.lynch [at] thenowfactory>
>
> Hi Luca,
>>
>> I was looking at the code in pfring kernel module function
>> ring_alloc_mem() to see how the module param min_num_slots impacts on the
>> amount of memory allocated for the ring.
>> I am wondering what the highlighted line below is doing. What alignment is
>> it looking to achieve? (it was added in revision 4400).
>>
>> /* Alignment necessary on ARM platforms */
>> num_pages = tot_mem / PAGE_SIZE;
>> num_pages += (num_pages + (SHMLBA-1)) % SHMLBA;
>>
>> On x86, SHMLBA is defined as PAGE_SIZE. On ARM SHMLBA it is defined as (4
>> * PAGE_SIZE)
>>
>
> SHMLBA is a multiple needed in some architectures with virtually indexed L1
> caches, which suffer from aliasing problems, to make virtual aliases
> coherent
>
> Best Regards
> Alfredo
>
>
> _______________________________________________
> Ntop-misc mailing list
> Ntop-misc [at] listgateway
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
>
>


cardigliano at ntop

May 13, 2011, 10:10 AM

Post #4 of 4 (595 views)
Permalink
Re: ring_alloc_mem() in pf_ring kernel module [In reply to]

Jonathan
As you said SHMLBA is defined as PAGE_SIZE on x86 platforms, so you should
not worry about that.
Anyway, there was an error computing the memory size, but we fixed it today.
Check it out.

Best regards
Alfredo

2011/5/11 Lynch, Jonathan <jonathan.lynch [at] thenowfactory>

> Is this something that could be put inside a ARCH define and just set for
> the relevant architectures?
>
> Does this functionality added to vmalloc_user() in kernel 2.6.32 provide
> the alignment necessary?
>
> http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2dca6999eed58d44b67e9de7d6ec230f6250553d
>
> On 10 May 2011 17:27, Alfredo Cardigliano <cardigliano [at] ntop> wrote:
>
>>
>> 2011/5/10 Lynch, Jonathan <jonathan.lynch [at] thenowfactory>
>>
>> Hi Luca,
>>>
>>> I was looking at the code in pfring kernel module function
>>> ring_alloc_mem() to see how the module param min_num_slots impacts on the
>>> amount of memory allocated for the ring.
>>> I am wondering what the highlighted line below is doing. What alignment
>>> is it looking to achieve? (it was added in revision 4400).
>>>
>>> /* Alignment necessary on ARM platforms */
>>> num_pages = tot_mem / PAGE_SIZE;
>>> num_pages += (num_pages + (SHMLBA-1)) % SHMLBA;
>>>
>>> On x86, SHMLBA is defined as PAGE_SIZE. On ARM SHMLBA it is defined as
>>> (4 * PAGE_SIZE)
>>>
>>
>> SHMLBA is a multiple needed in some architectures with virtually indexed
>> L1 caches, which suffer from aliasing problems, to make virtual aliases
>> coherent
>>
>> Best Regards
>> Alfredo
>>
>>
>> _______________________________________________
>> Ntop-misc mailing list
>> Ntop-misc [at] listgateway
>> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
>>
>>
>
> _______________________________________________
> Ntop-misc mailing list
> Ntop-misc [at] listgateway
> http://listgateway.unipi.it/mailman/listinfo/ntop-misc
>
>

NTop misc RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.