[ofa-general] Re: [PATCH v2] opensm: free lft_buf if it matches switch's lft
Yevgeny Kliteynik
kliteyn at dev.mellanox.co.il
Thu Oct 30 14:51:25 PDT 2008
Sasha Khapyorsky wrote:
> Hi Yevgeny,
>
> On 18:03 Thu 30 Oct , Yevgeny Kliteynik wrote:
>> Sasha,
>>
>> This patch frees the switch's lft_buf if it matches the
>> LFT that is currently configured on switch.
>>
>> Signed-off-by: Yevgeny Kliteynik <kliteyn at dev.mellanox.co.il>
>
> I applied this. Thanks. However one question below.
>
> [snip...]
>
>> diff --git a/opensm/opensm/osm_ucast_mgr.c b/opensm/opensm/osm_ucast_mgr.c
>> index adb6688..175817c 100644
>> --- a/opensm/opensm/osm_ucast_mgr.c
>> +++ b/opensm/opensm/osm_ucast_mgr.c
>> @@ -392,6 +392,20 @@ int osm_ucast_mgr_set_fwd_table(IN osm_ucast_mgr_t * const p_mgr,
>> context.lft_context.node_guid = osm_node_get_node_guid(p_node);
>> context.lft_context.set_method = TRUE;
>>
>> + if (!p_sw->lft_buf) {
>> + /* any routing should provide the lft_buf */
>> + CL_ASSERT(p_mgr->p_subn->opt.use_ucast_cache &&
>> + p_mgr->cache_valid && !p_sw->need_update);
>> + goto Exit;
>> + }
>> +
>> + if (!p_sw->need_update &&
>> + !memcmp(p_sw->lft, p_sw->lft_buf, IB_LID_UCAST_END_HO + 1)) {
>> + free(p_sw->lft_buf);
>> + p_sw->lft_buf = NULL;
>> + goto Exit;
>> + }
>> +
>
> So buffers are freed only on next routing iteration (heavy sweep). Isn't
> it better to drop it when LFT images from switches are received in
> osm_lin_fwd_rcv.c?
Sure, why not. That way the memory would be freed faster.
-- Yevgeny
> Sasha
>
More information about the general
mailing list