2002-03-20 04:18:29

by Andrew Morton

[permalink] [raw]
Subject: aa-160-lru_release_check



Hugh's much-discussed check for releasing pages which are still on the LRU.


=====================================

--- 2.4.19-pre3/mm/page_alloc.c~aa-160-lru_release_check Tue Mar 19 19:49:02 2002
+++ 2.4.19-pre3-akpm/mm/page_alloc.c Tue Mar 19 19:49:02 2002
@@ -102,8 +102,11 @@ static void __free_pages_ok (struct page
/* Yes, think what happens when other parts of the kernel take
* a reference to a page in order to pin it for io. -ben
*/
- if (PageLRU(page))
+ if (PageLRU(page)) {
+ if (unlikely(in_interrupt()))
+ BUG();
lru_cache_del(page);
+ }

if (page->buffers)
BUG();

-


2002-03-20 16:10:04

by Adrian Bunk

[permalink] [raw]
Subject: Re: aa-160-lru_release_check

On Tue, 19 Mar 2002, Andrew Morton wrote:

>...
> + if (unlikely(in_interrupt()))
> + BUG();
>...

Is there a reason against intruducing BUG_ON in 2.4? It makes such things
more readable.

cu
Adrian


2002-03-20 19:16:01

by Mike Fedyk

[permalink] [raw]
Subject: Re: aa-160-lru_release_check

On Wed, Mar 20, 2002 at 05:09:32PM +0100, Adrian Bunk wrote:
> On Tue, 19 Mar 2002, Andrew Morton wrote:
>
> >...
> > + if (unlikely(in_interrupt()))
> > + BUG();
> >...
>
> Is there a reason against intruducing BUG_ON in 2.4? It makes such things
> more readable.
>

I think there are plans to do so...

... But not in this patch.

2002-03-20 19:31:16

by Andrew Morton

[permalink] [raw]
Subject: Re: aa-160-lru_release_check

Adrian Bunk wrote:
>
> On Tue, 19 Mar 2002, Andrew Morton wrote:
>
> >...
> > + if (unlikely(in_interrupt()))
> > + BUG();
> >...
>
> Is there a reason against intruducing BUG_ON in 2.4? It makes such things
> more readable.
>

I hate BUG_ON() :) It's arse-about so you have to stare at it furiously
to understand why your kernel still works.

I hope the Nobel committee is reading this mailing list: how
about assert()?

-

2002-03-20 19:39:36

by Jeff Garzik

[permalink] [raw]
Subject: Re: aa-160-lru_release_check

Andrew Morton wrote:

>I hate BUG_ON() :) It's arse-about so you have to stare at it furiously
>to understand why your kernel still works.
>
>I hope the Nobel committee is reading this mailing list: how
>about assert()?
>

I vote 'aye'

It's the same thing just in another name.

I would call it kassert or fixup existing places that use 'assert'
first, though.

Jeff




2002-03-20 20:02:58

by Dave Jones

[permalink] [raw]
Subject: Re: aa-160-lru_release_check

On Wed, Mar 20, 2002 at 11:28:36AM -0800, Andrew Morton wrote:
> > Is there a reason against intruducing BUG_ON in 2.4? It makes such things
> > more readable.
> I hate BUG_ON() :) It's arse-about so you have to stare at it furiously
> to understand why your kernel still works.

Preach on brother Morton.

> I hope the Nobel committee is reading this mailing list: how
> about assert()?

Quite a few places in the kernel already are.
See drivers/net/pci-skeleton.c for one.

--
| Dave Jones. http://www.codemonkey.org.uk
| SuSE Labs

2002-03-20 20:42:47

by Robert Love

[permalink] [raw]
Subject: Re: aa-160-lru_release_check

On Wed, 2002-03-20 at 14:28, Andrew Morton wrote:

> I hate BUG_ON() :) It's arse-about so you have to stare at it furiously
> to understand why your kernel still works.
>
> I hope the Nobel committee is reading this mailing list: how
> about assert()?

I have a patch that introduces BUG_ON for 2.4. I like the idea of
BUG_ON and it is certainly a place where the unlikely bit is useful.
I've posted the patch here before; I was going to do so again against
the next 2.4-pre.

Further, and most importantly, the patch provides compatibility with 2.5
code that uses it. I have no problems naming BUG_ON anything anyone
wants (Jeff's suggestion of kassert seems sane) but we should then do
the proper renaming in 2.5.

Robert Love