All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jack Morgenstein <jackm-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
To: Roland Dreier <roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	matt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org
Subject: Re: [PATCH for-next 3/7] net/mlx4_core: change bitmap allocator to work in round-robin fashion
Date: Wed, 9 May 2012 16:04:32 +0300	[thread overview]
Message-ID: <201205091604.33167.jackm@dev.mellanox.co.il> (raw)
In-Reply-To: <CAL1RGDXYeGZCWty5ysfOTD_yYaSJb+FCGsDyG3P7pszDnG43tQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Tuesday 08 May 2012 21:46, Roland Dreier wrote:
> > --- a/drivers/net/ethernet/mellanox/mlx4/alloc.c
> > +++ b/drivers/net/ethernet/mellanox/mlx4/alloc.c
> > @@ -124,7 +124,6 @@ void mlx4_bitmap_free_range(struct mlx4_bitmap *bitmap, u32 obj, int cnt)
> >
> >        spin_lock(&bitmap->lock);
> >        bitmap_clear(bitmap->table, obj, cnt);
> > -       bitmap->last = min(bitmap->last, obj);
> >        bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
> >                        & bitmap->mask;
> >        bitmap->avail += cnt;
> 
> I think this mostly makes sense, although the explanation doesn't quite
> make sense.
> 
> However I think it would also make sense to get rid of changing the
> bitmap->top value here when freeing.  Then we would really go
> round-robin, and only bump bitmap->top each time we wrap around
> during allocation.
> 
> Does that make sense to you?

It does make sense.  Very good catch!  If we also get rid of the bitmap_top
modification in mlx4_bitmap_free_range(), then it will be a VERY long time
before resource numbers repeat. This can only be a good thing.

You are correct that if we do not immediately re-use resource numbers,
then incrementing bitmap_top is only really needed/desirable per wrap-around of the
bitmap.

-Jack
> 
>  - R.
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2012-05-09 13:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-29 14:04 [PATCH for-next 0/7] IB: initial batch of patches for 3.5 Or Gerlitz
     [not found] ` <1335708267-30284-1-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-04-29 14:04   ` [PATCH for-next 1/7] IB/iser: Fix buggy error flow in iser ep connection establishment Or Gerlitz
     [not found]     ` <1335708267-30284-2-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-05-03 17:55       ` Roland Dreier
     [not found]         ` <CAL1RGDUN_ue8LRhU_ZYxSpC=HsCTdHEriZOQVVARwDqYpM=m2w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-04  3:09           ` Or Gerlitz
2012-04-29 14:04   ` [PATCH for-next 2/7] IB/core: enhance the qp use counter to track multicast attach/detach Or Gerlitz
     [not found]     ` <1335708267-30284-3-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-05-04  4:46       ` Roland Dreier
     [not found]         ` <CAL1RGDUne=WeaJaUqyRcOUoURFGukaVY6PNxb0GodW2MG5i2Kg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-07 19:45           ` Or Gerlitz
2012-04-29 14:04   ` [PATCH for-next 3/7] net/mlx4_core: change bitmap allocator to work in round-robin fashion Or Gerlitz
     [not found]     ` <1335708267-30284-4-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-05-08 18:46       ` Roland Dreier
     [not found]         ` <CAL1RGDXYeGZCWty5ysfOTD_yYaSJb+FCGsDyG3P7pszDnG43tQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-09 13:04           ` Jack Morgenstein [this message]
2012-04-29 14:04   ` [PATCH for-next 4/7] IB/mlx4: put priority bits in WQE of IBoE MLX QP Or Gerlitz
     [not found]     ` <1335708267-30284-5-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-05-08 18:48       ` Roland Dreier
     [not found]         ` <CAL1RGDUeKh7Nu3bAWsbGnjWWpySp5s=8VUUcmTMOn9s8GMPxcg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-05-09  6:25           ` Or Gerlitz
2012-05-09  6:25           ` Or Gerlitz
2012-04-29 14:04   ` [PATCH for-next 5/7] net/mlx4: add new cap flags field to track more capabilities Or Gerlitz
     [not found]     ` <1335708267-30284-6-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-05-08 18:55       ` Roland Dreier
2012-04-29 14:04   ` [PATCH for-next 6/7] IB/mlx4: replace KERN_yyy printk call with pr_yyy ones Or Gerlitz
     [not found]     ` <1335708267-30284-7-git-send-email-ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2012-05-08 19:00       ` Roland Dreier
2012-04-29 14:04   ` [PATCH for-next 7/7] IB/mlx4: increase the number of vectors (EQs) available for ULPs Or Gerlitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201205091604.33167.jackm@dev.mellanox.co.il \
    --to=jackm-ldsdmyg8hgv8yrgs2mwiifqbs+8scbdb@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=ogerlitz-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
    --cc=roland-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.