On Tue, May 19, 2015 at 02:24:17PM +0800, Wei Yang wrote: > In commit d74b9027a4da(PCI: Consider additional PF's IOV BAR alignment in > sizing and assigning), it stores additional alignment in realloc_head and > take this into consideration for assignment. > > After getting the additional alignment, it will re-order the head list to > make sure resources with bigger alignment is ahead of the resources with > smaller assignment in the head list. To make it happen, it iterate on the > head list and find a smaller alignment resource and insert ahead of it. > This should be done for the first occurrence, while the code now will > iterate on the whole list. > > This patch fixes this behavior by break when finding the first smaller > resource in the head list. > > Signed-off-by: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx> I applied this with the following changelog, included here so search engines can find the original thread: PCI: Fix IOV resource sorting by alignment requirement In d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning"), it stores additional alignment in realloc_head and takes this into consideration for assignment. After getting the additional alignment, it reorders the head list so resources with bigger alignment are ahead of resources with smaller alignment. It does this by iterating over the head list and inserting ahead of any resource with smaller alignment. This should be done for the first occurrence, but the code currently iterates over the whole list. Fix this by terminating the loop when we find the first smaller resource in the head list. [bhelgaas: changelog] Fixes: d74b9027a4da ("PCI: Consider additional PF's IOV BAR alignment in sizing and assigning") Signed-off-by: Wei Yang <weiyang@xxxxxxxxxxxxxxxxxx> Signed-off-by: Bjorn Helgaas <bhelgaas@xxxxxxxxxx> -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html