Re: Another crash with 2.1.42 + mmap patches

Mark Hemment (markhe@sco.COM)
Tue, 10 Jun 1997 15:14:00 +0100 (BST)


On Tue, 10 Jun 1997 wrote:
> This is on my home computer, which is a Pentium with everything
> up-to-date, most things compiled as modules (ethernet, cdrom, sound
> card, printer). It's stock 2.1.42 except for the mmap patch (which it
> needs to stay up for more than a couple of hours).

OK, I've found the patch you mean at LinuxHQ.

> Here's the first crash:
> kmem_cache_reap() called within int!
> Scheduling in interrupt

Yeek! try_to_free_page() is being called during an interrupt!

> Using `/build/kernel/linux-2.1.42/' to map addresses to symbols.
> Trace: c0145a8f <dev_alloc_skb+f/28>

...and here is the call.
The priority is GFP_ATOMIC, but the mmap patch doesn't honour this.

> Here's the second error:
> kmem_cache_reap() called within int!
> last message repeated 2 times
> Aiee, killing interrupt handler
> eth0: Tx request while isr active.

Same problem as above.

I do not have a clean 2.1.42 tree to apply the patch to, but from reading
the patch, mm/page_alloc.c/__get_free_page() will call try_to_free_page()
if the pri is GFP_ATOMIC and the free-pool cannot honour the request..
This is a big NO as the functions called by try_to_free_page() can block -
hence the panics!

The solution is to stop the call for GFP_ATOMIC (and for GFP_BUFFER when
the nr_free_pages is low).
Try changing the code for __get_free_page() to look like;

spin_lock_irqsave(&page_alloc_lock, flags);
if ((priority==GFP_ATOMIC) || nr_free_pages > reserved_pages) {
RMQUEUE(order, dma);}
spin_unlock_irqrestore(&page_alloc_lock, flags);
if (priority==GFP_ATOMIC || priority==GFP_BUFFER)
return NULL;
if (!tries) {

Hopefully I'm reading the mmap diff correctly :(
Perhaps someone with a tree who can apply the mmap-diff, can make a
patch for this change (and check my suggested mod). Hopefully the orignal
author will pick this up....



Mark Hemment UNIX/C Software Engineer (contractor)
"Success has many fathers. Failure is a b**tard"