Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4931650imm; Wed, 30 May 2018 15:10:50 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJbfXAddTQfTtrja/0utX+Po7ZVLoEP2pC57Y3aT/cF8hJiydliTfyXcLy0muucW6EujEHR X-Received: by 2002:a62:568f:: with SMTP id h15-v6mr4378838pfj.131.1527718250178; Wed, 30 May 2018 15:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527718250; cv=none; d=google.com; s=arc-20160816; b=cCeEiVA5RrtfGuJ73Sy1EDQit5a2JS33tzVhiihBOfhIJ2pp8jGUUBYmtpMBANiy0q fN1w4LwYc7nCRtLto78tZ4X1Ivd/ogyp516lVkfrSBo7gB63y8nZiLIymuAaSJaNzre4 jzd68I3+BNEztaiP/i0IEDy8xXXk8z6qCUCB7Yy+OoZws7tqEIOrk2gI2mPTGiAZEHoD q/vikZ0o2zOnHMYcLwsuEa2N3yIRQAPLZGtBUUZ8zlBKeUO1hFbNRHCPrdEOXTifMUpA rfa6Ci02r6WrJ0I8kF6JscT/T8NcPb4M9BlUZnlV8gs88DrE3AtG2RG+2dpm2ujT4ITS 4+xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=4M3ojKTSlRckbs8ADdWSQUPV46ULhA/3vXpp2dInch4=; b=pQbmuD7Mye/TvpaRxLbwpgc1FoFmD8thrXs7t7VAmNp81mQByEAwfIzgF4ja5Kqycv 029Qd1plBlbaZEAtf4oiw3+cEJ20+GMbUw0Nn/PzClC4beeaDA55yBH4Rizqx1+HS98J 2n/kx4/neQF5PBqI68VIFNXMQ8ET+5XmK9ty4F2mJuI+4ZhYsoWweZVAtPVkkFUgi4w3 DjoWdU6WQp21m3ywL+TXoI9DEPKbGHRchiIzKP40kvANaoGn/62ol9QEDQFPUzKVw1WF WyKPBlNaOQj8gn1N8HwENvpZv7Fbh/jCN6sKq8hNso5TU88PMy/mwEDreJ7rmfrjPIfk k7+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=EDEMa4bz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f34-v6si19180979ple.165.2018.05.30.15.10.35; Wed, 30 May 2018 15:10:50 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=EDEMa4bz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753758AbeE3WJo (ORCPT + 99 others); Wed, 30 May 2018 18:09:44 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:34474 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753617AbeE3WJk (ORCPT ); Wed, 30 May 2018 18:09:40 -0400 Received: by mail-wr0-f196.google.com with SMTP id j1-v6so31023350wrm.1 for ; Wed, 30 May 2018 15:09:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=4M3ojKTSlRckbs8ADdWSQUPV46ULhA/3vXpp2dInch4=; b=EDEMa4bzFwM5oZzmKLzu2+u6aPVC+qKfU2OMtjhIsRYZIOlfuhZes0Nvj5yxBzmVuW 0oEe3w1NzSn6m1iljUZkXks9m4fwlVkSf7xGV0BhK/x5rE6/l/N4BfXwjUnS3Cgs4tCo Fs8TbYAhpo/9jB73tQk4JrfLwwqwpTVUT+R3uJrOS3NBfi+o8zmalIczNLkHGG2XxK9o g4ZP2ahkpGguBbrTMpxIg2g06atZhWyBVjAJcqnEGmJMu0ufTNb4w+SMf0XQ3K9s+yNT s7NgiuXBn60vPDeTXCtunwXRB3woJLch0RZM62y0ujYGhVDvpA0sRfH7x2px2ITNLk6J i4+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=4M3ojKTSlRckbs8ADdWSQUPV46ULhA/3vXpp2dInch4=; b=hKHpN97CDuoJkF41aMpK2WDFyMa3J100PdbyQ2MXnhPZk0PqAHZmOlsolq1JjMKHZo BOzPd5KVKLrDnAbt7jacme3N4OJSm3IEakHuRIrhznj28Eub/sdG0tz2q4X7mCio5Cz4 cxGjOszxUKx88QLSMxRsImD059Vs6iy2vNOsZyRy0uu9VRs1JUzMSVuPBWFlR6sdDI2c IDpQy4gd7MO78UX3spfsMIMqflMw4NzczRAO4KxjCO28733e5LlperCth45ACwFxMbse 3x3UkXh0djn4iknK7WrPJVZw7mblCOUmVotq4KuaLX0mP8XZxN+sktdf7A/XOxhBBSTy UVLQ== X-Gm-Message-State: ALKqPwdGEoO4WcqrXIZKWlYdXw2vWa+2+KWUwlpIqZkITGSW8VUslH4B OSsCnIf5Ze1cFFaVeM1FIZpDfw== X-Received: by 2002:adf:d086:: with SMTP id y6-v6mr3536434wrh.152.1527718179628; Wed, 30 May 2018 15:09:39 -0700 (PDT) Received: from ziepe.ca (S010614cc2056d97f.ed.shawcable.net. [174.3.196.123]) by smtp.gmail.com with ESMTPSA id d12-v6sm39634313wrg.2.2018.05.30.15.09.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 May 2018 15:09:38 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.86_2) (envelope-from ) id 1fO9Hi-0004Ws-Rg; Wed, 30 May 2018 16:09:34 -0600 Date: Wed, 30 May 2018 16:09:34 -0600 From: Jason Gunthorpe To: =?utf-8?B?SMOla29u?= Bugge Cc: Hans Westgaard Ry , jackm , Doug Ledford , Daniel Jurgens , Parav Pandit , Pravin Shedge , OFED mailing list , linux-kernel@vger.kernel.org, Leon Romanovsky Subject: Re: [PATCH] IB/mad: Use ID allocator routines to allocate agent number Message-ID: <20180530220934.GI30754@ziepe.ca> References: <20180529073808.27735-1-hans.westgaard.ry@oracle.com> <20180529154922.GA18457@ziepe.ca> <20180529164032.GB18457@ziepe.ca> <20180530110216.00000913@dev.mellanox.co.il> <20180530151023.GB30754@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 30, 2018 at 10:07:16PM +0200, HÃ¥kon Bugge wrote: > > > > On 30 May 2018, at 17:10, Jason Gunthorpe wrote: > > > > On Wed, May 30, 2018 at 02:22:56PM +0200, Hans Westgaard Ry wrote: > > > >> We came up with this code snippet which we think handles both preventing > >> immediate re-use and too big/wrapping... > > > > Isn't this basically the same as idr_alloc_cyclic ? > > I draw my statement back. The idr_alloc_cyclic() is the family of idr's that associates a pointer with the bit. Hence, each bit is a bit + 64b. > > That's why we ended up with Hans' pseudo code. Okay, fair enough. Is it worth adding a ida_get_new_cyclic for this? Jason