From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932246AbeE3UGr (ORCPT ); Wed, 30 May 2018 16:06:47 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:47544 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753718AbeE3UGo (ORCPT ); Wed, 30 May 2018 16:06:44 -0400 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: [PATCH] IB/mad: Use ID allocator routines to allocate agent number From: =?utf-8?Q?H=C3=A5kon_Bugge?= In-Reply-To: <20180530151023.GB30754@ziepe.ca> Date: Wed, 30 May 2018 22:07:16 +0200 Cc: Hans Westgaard Ry , jackm , Doug Ledford , Daniel Jurgens , Parav Pandit , Pravin Shedge , OFED mailing list , linux-kernel@vger.kernel.org, Leon Romanovsky Message-Id: 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> To: Jason Gunthorpe X-Mailer: Apple Mail (2.3445.6.18) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8909 signatures=668702 X-Proofpoint-Spam-Details: rule=notspam policy=default score=3 suspectscore=2 malwarescore=0 phishscore=0 bulkscore=0 spamscore=3 mlxscore=3 mlxlogscore=158 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1805220000 definitions=main-1805300214 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id w4UK6sRh013934 > 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. Thxs, HÃ¥kon > > Jason > -- > To unsubscribe from this list: send the line "unsubscribe linux-rdma" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html