public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make sure nobody's leaking resources
@ 2006-03-20 15:53 Matthew Wilcox
  2006-03-20 16:10 ` Muli Ben-Yehuda
  0 siblings, 1 reply; 3+ messages in thread
From: Matthew Wilcox @ 2006-03-20 15:53 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds; +Cc: linux-kernel


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.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>

diff -urpNX dontdiff linus-2.6/kernel/resource.c parisc-2.6/kernel/resource.c
--- linus-2.6/kernel/resource.c	2006-03-20 07:29:06.000000000 -0700
+++ parisc-2.6/kernel/resource.c	2006-03-20 07:00:47.000000000 -0700
@@ -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;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make sure nobody's leaking resources
  2006-03-20 15:53 [PATCH] Make sure nobody's leaking resources Matthew Wilcox
@ 2006-03-20 16:10 ` Muli Ben-Yehuda
  2006-03-20 21:34   ` Andrew Morton
  0 siblings, 1 reply; 3+ messages in thread
From: Muli Ben-Yehuda @ 2006-03-20 16:10 UTC (permalink / raw)
  To: Matthew Wilcox; +Cc: Andrew Morton, Linus Torvalds, linux-kernel

On Mon, Mar 20, 2006 at 08:53:04AM -0700, Matthew Wilcox wrote:
> 
> 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.
> 
> Signed-off-by: Matthew Wilcox <matthew@wil.cx>
> 
> diff -urpNX dontdiff linus-2.6/kernel/resource.c parisc-2.6/kernel/resource.c
> --- linus-2.6/kernel/resource.c	2006-03-20 07:29:06.000000000 -0700
> +++ parisc-2.6/kernel/resource.c	2006-03-20 07:00:47.000000000 -0700
> @@ -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
-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Make sure nobody's leaking resources
  2006-03-20 16:10 ` Muli Ben-Yehuda
@ 2006-03-20 21:34   ` Andrew Morton
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2006-03-20 21:34 UTC (permalink / raw)
  To: Muli Ben-Yehuda; +Cc: matthew, torvalds, linux-kernel

Muli Ben-Yehuda <mulix@mulix.org> wrote:
>
> On Mon, Mar 20, 2006 at 08:53:04AM -0700, Matthew Wilcox wrote:
> > 
> > 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.
> > 
> > Signed-off-by: Matthew Wilcox <matthew@wil.cx>
> > 
> > diff -urpNX dontdiff linus-2.6/kernel/resource.c parisc-2.6/kernel/resource.c
> > --- linus-2.6/kernel/resource.c	2006-03-20 07:29:06.000000000 -0700
> > +++ parisc-2.6/kernel/resource.c	2006-03-20 07:00:47.000000000 -0700
> > @@ -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.
> 

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-03-20 21:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-20 15:53 [PATCH] Make sure nobody's leaking resources Matthew Wilcox
2006-03-20 16:10 ` Muli Ben-Yehuda
2006-03-20 21:34   ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox