RE: [RFC PATCH V2 1/10] mm/resource: Move child to new resource when release mem region.

From: Michael Kelley
Date: Mon Jan 20 2020 - 14:21:02 EST


From: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx> Sent: Tuesday, January 7, 2020 5:10 AM
>
> When release mem region, old mem region may be splited to
> two regions. Current allocate new struct resource for high
> end mem region but not move child resources whose ranges are
> in the high end range to new resource. When adjust old mem
> region's range, adjust_resource() detects child region's range
> is out of new range and return error. Move child resources to
> high end resource before adjusting old mem range.

Let me also suggests some wording improvements to the commit message:

When releasing a mem region, the old mem region may need to be
split into two regions. In this case, the current code allocates the new
region and adjust the original region to specify a smaller range. But child
regions that fall into the range of the new region are not moved to that
new region. Consequently, when running __adjust_resource() on the
original region, it detects that the child region's range is out of the new
range, and returns an error.

Fix this by moving appropriate child resources to the new region before
adjusting the original mem region range.

>
> Signed-off-by: Tianyu Lan <Tianyu.Lan@xxxxxxxxxxxxx>
> ---
> kernel/resource.c | 38 ++++++++++++++++++++++++++++++++++----
> 1 file changed, 34 insertions(+), 4 deletions(-)
>