mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-01 08:04:22 +08:00
kernel/resource: Increment by align value in get_free_mem_region()
[ Upstream commit659aa050a5
] Currently get_free_mem_region() searches for available capacity in increments equal to the region size being requested. This can cause the search to take giant steps through the resource leaving needless gaps and missing available space. Specifically 'cxl create-region' fails with ERANGE even though capacity of the given size and CXL's expected 256M x InterleaveWays alignment can be satisfied. Replace the total-request-size increment with a next alignment increment so that the next possible address is always examined for availability. Fixes:14b80582c4
("resource: Introduce alloc_free_mem_region()") Reported-by: Dmytro Adamenko <dmytro.adamenko@intel.com> Reported-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Alison Schofield <alison.schofield@intel.com> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20231113221324.1118092-1-alison.schofield@intel.com Cc: Jason Gunthorpe <jgg@nvidia.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Dan Williams <dan.j.williams@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
4c269350e3
commit
e4a5b2f60e
@ -1847,8 +1847,8 @@ get_free_mem_region(struct device *dev, struct resource *base,
|
||||
|
||||
write_lock(&resource_lock);
|
||||
for (addr = gfr_start(base, size, align, flags);
|
||||
gfr_continue(base, addr, size, flags);
|
||||
addr = gfr_next(addr, size, flags)) {
|
||||
gfr_continue(base, addr, align, flags);
|
||||
addr = gfr_next(addr, align, flags)) {
|
||||
if (__region_intersects(base, addr, size, 0, IORES_DESC_NONE) !=
|
||||
REGION_DISJOINT)
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user