[openib-general] Re: [PATCH] memory leaks in ipoib, srp

Michael S. Tsirkin mst at mellanox.co.il
Thu Sep 1 11:34:33 PDT 2005


Quoting r. Roland Dreier <rolandd at cisco.com>:
>     Michael> BTW, opinions on the newer version I sent?
> 
> I'm undecided.  On the one hand, it seems like a reasonable thing to
> do. On the other hand, I'm not sure whether having two remove entry
> points is just going to confuse people.

OKay ... lets just add a flag to client instead.

struct ib_client {
        char  *name;
        struct ib_client_data *(*add)   (struct ib_device *);
        void (*remove)(struct ib_device *, struct ib_client_data *);
	int have_client_data;
        struct list_head list;
};

Better?

> And in any case I don't see
> the real motivation for making the change now.

Type-safety is one. Cleaner memory management is another:
its better for clients to allocate their own memory,
as the two leaks that I sent patches for previously demonstrate.

An additional thinking behind this is: ULPs (e.g. SDP, CM)
need to keep lists of per-device objects and kill them on device
removal.
For example with change Sean proposes SDP will need to keep
a list of per-device cm_ids in each connection.
One idea, then, is in this example to make each cm_id a client,
then this list is managed by device.c

Client list then becomes very long, so its important to get
client data from device without scanning the client list.


-- 
MST



More information about the general mailing list