On Tue, Nov 10, 2020 at 09:19:39AM +0000, liweihang wrote: > On 2020/11/6 21:37, Jason Gunthorpe wrote: > > On Fri, Nov 06, 2020 at 01:52:57AM +0000, liweihang wrote: > > > >> There are 8 banks and each of them has a counter which represents > >> how many QPs are using this bank. We first find the bank with the > >> smallest count, and then try to find a QPN belongs to this bank > >> according to the bitmap. The ida will find an unused ID starting > >> from 0, I think it can't meet our needs. If we use ida here, the > >> code may looks like: > > > > I don't understand, why wouldn't the ida give you a free QPN in a bank > > directly? > > > > Jason > > > > Hi Jason, > > Here is the QPN that belongs to each bank: > > QPN on bank0:0, 8, 16, 24 ... <lower three bits is 0> > QPN on bank1: 1, 9, 17, 25 ... <lower three bits is 1> > QPN on bank2: 2, 10, 18, 26 ... <lower three bits is 2> > ... > QPN on bank6: 6, 14, 22, 30 ... <lower three bits is 6> > QPN on bank7: 7, 15, 23, 31 ... <lower three bits is 7> > > If bank 6 is the one with the lowest load, then we need to find a > valid QPN belongs to bank6, that means, the lower 3 bits of QPN is > 6 and it hasn't been used. > We can't find out a way to use ida in this situation because the > QPNs of each bank are discontinuous. Each bank has an IDA, you allocate from the IDA then shift left and or in the bank number Jason