Messages in this thread | | | Date | Thu, 2 Jul 2015 13:17:18 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH] perf: Fix multi-segment problem of perf_event_intel_uncore |
| |
On Thu, Jul 02, 2015 at 05:01:40AM +0900, Taku Izumi wrote: > + raw_spin_lock(&pci2phy_map_lock); > + list_for_each_entry(map, &pci2phy_map_head, list) { > + if (map->segment == pci_domain_nr(pdev->bus)) { > + phys_id = map->pbus_to_physid[pdev->bus->number]; > + break; > + } > + } > + raw_spin_unlock(&pci2phy_map_lock);
> + raw_spin_lock(&pci2phy_map_lock); > + list_for_each_entry(map, &pci2phy_map_head, list) { > + if (map->segment == pci_domain_nr(pdev->bus)) { > + phys_id = map->pbus_to_physid[pdev->bus->number]; > + break; > + } > + } > + raw_spin_unlock(&pci2phy_map_lock);
> + raw_spin_lock(&pci2phy_map_lock); > + list_for_each_entry(map, &pci2phy_map_head, list) { > + if (map->segment == segment) { > + found = true; > + break; > + } > + } > + if (!found) { > + map = kmalloc(sizeof(struct pci2phy_map), GFP_KERNEL); > + if (map) { > + map->segment = segment; > + map->pbus_to_physid[bus] = 0; > + list_add_tail(&map->list, &pci2phy_map_head); > + } > + } else { > + map->pbus_to_physid[bus] = 0; > + } > + raw_spin_unlock(&pci2phy_map_lock);
> + raw_spin_lock(&pci2phy_map_lock); > + list_for_each_entry(map, &pci2phy_map_head, list) { > + if (map->segment == segment) { > + found = true; > + break; > + } > + } > + if (!found) { > + map = kmalloc(sizeof(struct pci2phy_map), GFP_KERNEL); > + if (!map) { > + err = -ENOMEM; > + break; > + } > + map->segment = segment; > + list_add_tail(&map->list, &pci2phy_map_head); > + } > + raw_spin_unlock(&pci2phy_map_lock);
You'd think they invent something to avoid repetitions like that.. Oh wait..
| |