[openib-general] Re: [PATCH] mthca: fix registration for giant MRs

Roland Dreier roland at topspin.com
Thu Jun 2 09:07:55 PDT 2005


    Michael> I'd like to suggest we keep passing struct mthca_buddy
    Michael> *to mthca_alloc_mtt, instead of passing around and
    Michael> keeping in memory the binary fmr flag, since all that
    Michael> this flag does is select the right allocator, and callers
    Michael> of mthca_alloc_mtt/mthca_free_mtt already know which it
    Michael> is.

Makes sense, I'll add that change.

    Michael> + for (i = MTHCA_MTT_SEG_SIZE / 8; i < size; i <<= 1) ++mtt->order;

    Michael> At some point it'd be nice to support zero-sized regions,
    Michael> but meanwhile, isnt this better written as

    mtt->order = fls(max(size, MTHCA_MTT_SEG_SIZE / 8) - 1);

Again I'll do that.

    Michael> Why dont we keep mthca_mtt by instance in struct
    Michael> mthca_mr, like this: struct mthca_mr { struct ib_mr ibmr;
    Michael> struct mthca_mtt mtt; };

    Michael> Saves keeping around an extra small chunk of memory that
    Michael> we need to kfree/kmalloc/check.  mthca_alloc_mtt could
    Michael> get struct mthca_mtt* and use that.

My reasoning was that when we support shared memory regions we'll be
able to share MTTs just by adding a reference cound to the mtt
structure.

 - R.




More information about the general mailing list