netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 6/6] sctp: convert sctp_assoc_set_id to use idr_alloc_cyclic
       [not found] <1364412578-7462-1-git-send-email-jlayton@redhat.com>
@ 2013-03-27 19:29 ` Jeff Layton
  2013-03-28 13:53   ` Neil Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Layton @ 2013-03-27 19:29 UTC (permalink / raw)
  To: akpm
  Cc: linux-kernel, tj, Vlad Yasevich, Sridhar Samudrala, Neil Horman,
	David S. Miller, linux-sctp, netdev

(Note: compile-tested only)

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Cc: Sridhar Samudrala <sri@us.ibm.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: linux-sctp@vger.kernel.org
Cc: netdev@vger.kernel.org
---
 net/sctp/associola.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index d2709e2..fa261a3 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -66,13 +66,6 @@ static void sctp_assoc_bh_rcv(struct work_struct *work);
 static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc);
 static void sctp_assoc_free_asconf_queue(struct sctp_association *asoc);
 
-/* Keep track of the new idr low so that we don't re-use association id
- * numbers too fast.  It is protected by they idr spin lock is in the
- * range of 1 - INT_MAX.
- */
-static u32 idr_low = 1;
-
-
 /* 1st Level Abstractions. */
 
 /* Initialize a new association from provided memory. */
@@ -1601,13 +1594,8 @@ int sctp_assoc_set_id(struct sctp_association *asoc, gfp_t gfp)
 	if (preload)
 		idr_preload(gfp);
 	spin_lock_bh(&sctp_assocs_id_lock);
-	/* 0 is not a valid id, idr_low is always >= 1 */
-	ret = idr_alloc(&sctp_assocs_id, asoc, idr_low, 0, GFP_NOWAIT);
-	if (ret >= 0) {
-		idr_low = ret + 1;
-		if (idr_low == INT_MAX)
-			idr_low = 1;
-	}
+	/* 0 is not a valid assoc_id, must be >= 1 */
+	ret = idr_alloc_cyclic(&sctp_assocs_id, asoc, 1, 0, GFP_NOWAIT);
 	spin_unlock_bh(&sctp_assocs_id_lock);
 	if (preload)
 		idr_preload_end();
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 6/6] sctp: convert sctp_assoc_set_id to use idr_alloc_cyclic
  2013-03-27 19:29 ` [PATCH v2 6/6] sctp: convert sctp_assoc_set_id to use idr_alloc_cyclic Jeff Layton
@ 2013-03-28 13:53   ` Neil Horman
  2013-03-28 14:04     ` Neil Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Horman @ 2013-03-28 13:53 UTC (permalink / raw)
  To: Jeff Layton
  Cc: akpm, linux-kernel, tj, Vlad Yasevich, Sridhar Samudrala,
	David S. Miller, linux-sctp, netdev

On Wed, Mar 27, 2013 at 03:29:38PM -0400, Jeff Layton wrote:
> (Note: compile-tested only)
> 
> Signed-off-by: Jeff Layton <jlayton@redhat.com>
> Cc: Vlad Yasevich <vyasevich@gmail.com>
> Cc: Sridhar Samudrala <sri@us.ibm.com>
> Cc: Neil Horman <nhorman@tuxdriver.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: linux-sctp@vger.kernel.org
> Cc: netdev@vger.kernel.org
> ---
>  net/sctp/associola.c | 16 ++--------------
>  1 file changed, 2 insertions(+), 14 deletions(-)
> 
I don't see anything wrong with this patch per-se, but the idr_alloc_cyclic call
isn't integrated with net/net-next or Linus' tree yet.  If we don't gate this
patch on that integration, we'll break the build.
Neil

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 6/6] sctp: convert sctp_assoc_set_id to use idr_alloc_cyclic
  2013-03-28 13:53   ` Neil Horman
@ 2013-03-28 14:04     ` Neil Horman
  2013-03-31 10:23       ` Jeff Layton
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Horman @ 2013-03-28 14:04 UTC (permalink / raw)
  To: Jeff Layton
  Cc: akpm, linux-kernel, tj, Vlad Yasevich, Sridhar Samudrala,
	David S. Miller, linux-sctp, netdev

On Thu, Mar 28, 2013 at 09:53:08AM -0400, Neil Horman wrote:
> On Wed, Mar 27, 2013 at 03:29:38PM -0400, Jeff Layton wrote:
> > (Note: compile-tested only)
> > 
> > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > Cc: Vlad Yasevich <vyasevich@gmail.com>
> > Cc: Sridhar Samudrala <sri@us.ibm.com>
> > Cc: Neil Horman <nhorman@tuxdriver.com>
> > Cc: "David S. Miller" <davem@davemloft.net>
> > Cc: linux-sctp@vger.kernel.org
> > Cc: netdev@vger.kernel.org
> > ---
> >  net/sctp/associola.c | 16 ++--------------
> >  1 file changed, 2 insertions(+), 14 deletions(-)
> > 
> I don't see anything wrong with this patch per-se, but the idr_alloc_cyclic call
> isn't integrated with net/net-next or Linus' tree yet.  If we don't gate this
> patch on that integration, we'll break the build.
> Neil
> 
Actually, I just noticed that you only sent us 6/6 here, I'm assuming a prior
patch in the series adds the idr_alloc_cyclic code?  if so, I've seen the prior
version

Acked-by: Neil Horman <nhorman@tuxdriver.com>

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 6/6] sctp: convert sctp_assoc_set_id to use idr_alloc_cyclic
  2013-03-28 14:04     ` Neil Horman
@ 2013-03-31 10:23       ` Jeff Layton
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Layton @ 2013-03-31 10:23 UTC (permalink / raw)
  To: Neil Horman
  Cc: akpm, linux-kernel, tj, Vlad Yasevich, Sridhar Samudrala,
	David S. Miller, linux-sctp, netdev

On Thu, 28 Mar 2013 10:04:06 -0400
Neil Horman <nhorman@tuxdriver.com> wrote:

> On Thu, Mar 28, 2013 at 09:53:08AM -0400, Neil Horman wrote:
> > On Wed, Mar 27, 2013 at 03:29:38PM -0400, Jeff Layton wrote:
> > > (Note: compile-tested only)
> > > 
> > > Signed-off-by: Jeff Layton <jlayton@redhat.com>
> > > Cc: Vlad Yasevich <vyasevich@gmail.com>
> > > Cc: Sridhar Samudrala <sri@us.ibm.com>
> > > Cc: Neil Horman <nhorman@tuxdriver.com>
> > > Cc: "David S. Miller" <davem@davemloft.net>
> > > Cc: linux-sctp@vger.kernel.org
> > > Cc: netdev@vger.kernel.org
> > > ---
> > >  net/sctp/associola.c | 16 ++--------------
> > >  1 file changed, 2 insertions(+), 14 deletions(-)
> > > 
> > I don't see anything wrong with this patch per-se, but the idr_alloc_cyclic call
> > isn't integrated with net/net-next or Linus' tree yet.  If we don't gate this
> > patch on that integration, we'll break the build.
> > Neil
> > 
> Actually, I just noticed that you only sent us 6/6 here, I'm assuming a prior
> patch in the series adds the idr_alloc_cyclic code?  if so, I've seen the prior
> version


Yes, idr_alloc_cyclic is added in patch #1. v2 has some slight changes
from v1 but it's essentially the same concept.

> 
> Acked-by: Neil Horman <nhorman@tuxdriver.com>
> 

Thanks!
-- 
Jeff Layton <jlayton@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-31 10:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1364412578-7462-1-git-send-email-jlayton@redhat.com>
2013-03-27 19:29 ` [PATCH v2 6/6] sctp: convert sctp_assoc_set_id to use idr_alloc_cyclic Jeff Layton
2013-03-28 13:53   ` Neil Horman
2013-03-28 14:04     ` Neil Horman
2013-03-31 10:23       ` Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).