Make sure nobody's leaking resources
PATCH 1/1 Make sure nobody's leaking resources
Currently, releasing a resource also releases all of its children. That made sense when request_resource was the main method of dividing up the memory map. With the increased use of insert_resource, it seems to me that we should instead reparent the newly orphaned resources. Before we do that, let's make sure that nobody's actually relying on the current semantics.
kernel/resource.c +2 -0
@@ -181,6 +181,8 @@ static int __release_resource(struct res {struct resource *tmp, **p; +BUG_ON (old->child); + p = &old->parent->child;for (;;) { tmp = *p;
Quoted 14 lines · Matthew Wilcox
Currently, releasing a resource also releases all of its children. That made sense when
request_resourcewas the main method of dividing up the memory map. With the increased use ofinsert_resource, it seems to me that we should instead reparent the newly orphaned resources. Before we do that, let's make sure that nobody's actually relying on the current semantics.Signed-off-by Matthew Wilcox <[email protected]>diff -urpNX dontdiff
linus-2.6/kernel/resource.cparisc-2.6/kernel/resource.c
kernel/resource.c static int __release_resource(struct res · line 185
Quoted 5 lines
kernel/resource.c +2
-0@@ -181,6 +181,8 @@ static int __release_resource(struct res {struct resource *tmp, **p; +BUG_ON (old->child); +
Is this expressely forbidden at this stage, or just "not recommended"? if the latter, WARN_ON() might be more appropriate.
Cheers,
Muli
Signature · 2 lines
Muli Ben-Yehuda http://www.mulix.org | http://mulix.livejournal.com/
Quoted 19 lines · Muli Ben-Yehuda
Quoted 17 lines · Matthew Wilcox
Currently, releasing a resource also releases all of its children. That made sense when
request_resourcewas the main method of dividing up the memory map. With the increased use ofinsert_resource, it seems to me that we should instead reparent the newly orphaned resources. Before we do that, let's make sure that nobody's actually relying on the current semantics.Signed-off-by Matthew Wilcox <[email protected]>diff -urpNX dontdiff
linus-2.6/kernel/resource.cparisc-2.6/kernel/resource.ckernel/resource.c +0
-0@@ -181,6 +181,8 @@ static int __release_resource(struct res {struct resource *tmp, **p;
Quoted 6 lines
kernel/resource.c static int __release_resource(struct res · line 185
Quoted 2 lines
kernel/resource.c +2
-0+BUG_ON (old->child); +Is this expressely forbidden at this stage, or just "not recommended"? if the latter,
WARN_ON()might be more appropriate.
Yes, there's no way we can make changes like this to either -mm or to mainline. Making people's perfectly-working kernels go splat helps neither them nor us.
A WARN_ON() which shuts itself up after one or three invokations would be appropriate here.