> In mca_btl_tcp_alloc (openmpi-trunk/ompi/mca/btl/tcp/btl_tcp.c:188) the 
> first segment is initialized to point to "frag + 1".
> I don't get it... how/when is this location allocated? Isn't it just 
> after the mca_btl_tcp_frag_t structure ends?

Alex,
The frag allocation macros take the fragments from the free lists.
The free lists are created in function mca_btl_tcp_component_init().
As you will see there fragment size is mca_btl_tcp_frag_t + some_size.
frag + 1 , means skip the frag structure and jump to payload.

Bahazlaha ;-)

Pasha.

> 
> Thanks,
> Alex
> 
> mca_btl_base_descriptor_t* mca_btl_tcp_alloc(
>     struct mca_btl_base_module_t* btl,
>     struct mca_btl_base_endpoint_t* endpoint,
>     uint8_t order,
>     size_t size,
>     uint32_t flags)
> {
>     mca_btl_tcp_frag_t* frag = NULL;
>     int rc;
> 
>     if(size <= btl->btl_eager_limit) {
>         MCA_BTL_TCP_FRAG_ALLOC_EAGER(frag, rc);
>     } else if (size <= btl->btl_max_send_size) {
>         MCA_BTL_TCP_FRAG_ALLOC_MAX(frag, rc);
>     }
>     if( OPAL_UNLIKELY(NULL == frag) ) {
>         return NULL;
>     }
> 
>     frag->segments[0].seg_len = size;
>     frag->segments[0].seg_addr.pval = frag+1;
> 
>     frag->base.des_src = frag->segments;
>     frag->base.des_src_cnt = 1;
>     frag->base.des_dst = NULL;
>     frag->base.des_dst_cnt = 0;
>     frag->base.des_flags = flags;
>     frag->base.order = MCA_BTL_NO_ORDER;
>     frag->btl = (mca_btl_tcp_module_t*)btl;
>     return (mca_btl_base_descriptor_t*)frag;
> }
> _______________________________________________
> devel mailing list
> de...@open-mpi.org
> http://www.open-mpi.org/mailman/listinfo.cgi/devel


Reply via email to