[openib-general] please pull for 2.6.21: fix + add IB multicast support

Michael S. Tsirkin mst at mellanox.co.il
Fri Feb 9 00:04:19 PST 2007


> Quoting Roland Dreier <rdreier at cisco.com>:
> Subject: Re: please pull for 2.6.21: fix + add IB multicast support
> 
> I merged the "increment port number" and "remove redundant '_wq'"
> patches from git.openfabrics.org/~shefty/scm/rdma-dev.git for-roland
> 
> I plan to review to multicast stuff next week and I hope to merge it
> for 2.6.21.  Or, have you or anyone else at Voltaire read over the
> code in addition to using it?  Do you see anything that should be
> cleaned up?

I looked at the code briefly, don't have much time at the moment
unfortunately.

+static void join_group(struct mcast_group *group, struct mcast_member *member,
+                      u8 join_state)
+{
+       member->state = MCAST_MEMBER;
+       adjust_membership(group, join_state, 1);
+       group->rec.join_state |= join_state;
+       member->multicast.rec = group->rec;
+       member->multicast.rec.join_state = join_state;
+       list_del(&member->list);
+       list_add(&member->list, &group->active_list);
+}

Can be just list_move.

Patch allocates everything with kzalloc, but then goes ahead and initialize everything.
So just kmalloc it - no reason to waste initialized memory if non-initialized will do.
List of places:

+       member = kzalloc(sizeof *member, gfp_mask);
+       if (!member)
+               return ERR_PTR(-ENOMEM);


Same here:

+       group = kzalloc(sizeof *group, gfp_mask);
+       if (!group)
+               return NULL;
+

and same here:

+       iter = kzalloc(sizeof *iter + attr_size, GFP_KERNEL);
+       if (!iter)
+               return ERR_PTR(-ENOMEM);
+

It seems same goes for

+       mc = kzalloc(sizeof(*mc), GFP_KERNEL);
+       if (!mc)
+               return NULL;

in ucma.c - everything gets initied by calling function - but
a bit less sure, needs checking.

By the way, it seems same goes for

+       bind_list = kzalloc(sizeof *bind_list, GFP_KERNEL);
+       if (!bind_list)
+               return -ENOMEM;

in cma_alloc_any_port in the port randomization patch that was merged
and for cma_alloc_port in existing code.


-- 
MSTYou seem to be careful to do list_del_init for member->list all over,




More information about the general mailing list