__find_resource_space() calculates the full extent of empty space but only passes the aligned space to resource_alignf callback. In some situations, the callback may choose take advantage of the free space before the requested alignment. Pass the full extent of the calculated empty space to resource_alignf callback as an additional parameter.
Showing the changes to kernel (1 of 16 files). Show all
Unified · Split
| @@ -759,7 +759,8 @@ static int __find_resource_space(struct resource *root, struct resource *old, · 758 unmodified lines | |||
| 759 | alloc.flags = avail.flags; | 759 | alloc.flags = avail.flags; |
| 760 | if (alignf) { | 760 | if (alignf) { |
| 761 | alloc.start = alignf(constraint->alignf_data, | 761 | alloc.start = alignf(constraint->alignf_data, |
| 762 | &avail, size, constraint->align); | 762 | &avail, &tmp, |
| 763 | size, constraint->align); | ||
| 763 | } else { | 764 | } else { |
| 764 | alloc.start = avail.start; | 765 | alloc.start = avail.start; |
| 765 | } | 766 | } |