* [PATCH] __alloc_pages_limit pages_min
@ 2001-08-22 15:12 Roger Larsson
2001-08-22 17:01 ` Rik van Riel
0 siblings, 1 reply; 4+ messages in thread
From: Roger Larsson @ 2001-08-22 15:12 UTC (permalink / raw)
To: linux-mm
Hi all,
If __alloc_pages_limit is called with PAGES_HIGH and direct_reclaim.
It might alloc the last free page of a zone....
How:
* inactive_clean_pages >= pages_high
first if gives
if (free_pages + inactive_clean >= pages_high) => true
No direct_reclaim gives no attempt to call reclaim_page.
Instead rmqueue will be called...
now we have one page less - run it again...
free_pages will be decremented until zero...
Last page gone in a at PAGES_HIGH alloc!!!
Note: reclaim_page will fix this situation direct it is allowed to
run since it is kicked in __alloc_pages. But since we cannot
guarantee that this will never happen...
/RogerL
this patch is against 2.4.8-pre3 as it was my current kernel.
(searching for a USB storage bug...)
*******************************************
Patch prepared by: roger.larsson@norran.net
--- linux/mm/page_alloc.c.orig Wed Aug 22 13:36:57 2001
+++ linux/mm/page_alloc.c Wed Aug 22 13:50:31 2001
@@ -256,8 +256,9 @@
/* If possible, reclaim a page directly. */
if (direct_reclaim)
page = reclaim_page(z);
- /* If that fails, fall back to rmqueue. */
- if (!page)
+ /* If that fails, fall back to rmqueue, but do never
+ * go below free_pages for any zone*/
+ if (!page && z->free_pages >= z->pages_min)
page = rmqueue(z, order);
if (page)
return page;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] __alloc_pages_limit pages_min
2001-08-22 15:12 [PATCH] __alloc_pages_limit pages_min Roger Larsson
@ 2001-08-22 17:01 ` Rik van Riel
2001-08-22 20:58 ` Roger Larsson
0 siblings, 1 reply; 4+ messages in thread
From: Rik van Riel @ 2001-08-22 17:01 UTC (permalink / raw)
To: Roger Larsson; +Cc: linux-mm
On Wed, 22 Aug 2001, Roger Larsson wrote:
> Note: reclaim_page will fix this situation direct it is allowed to
> run since it is kicked in __alloc_pages. But since we cannot
> guarantee that this will never happen...
In this case kreclaimd will be woken up and the free pages
will be refilled.
Rik
--
IA64: a worthy successor to the i860.
http://www.surriel.com/
http://www.conectiva.com/ http://distro.conectiva.com/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] __alloc_pages_limit pages_min
2001-08-22 17:01 ` Rik van Riel
@ 2001-08-22 20:58 ` Roger Larsson
2001-08-22 21:10 ` Rik van Riel
0 siblings, 1 reply; 4+ messages in thread
From: Roger Larsson @ 2001-08-22 20:58 UTC (permalink / raw)
To: Rik van Riel; +Cc: linux-mm
On Wednesdayen den 22 August 2001 19:01, Rik van Riel wrote:
> On Wed, 22 Aug 2001, Roger Larsson wrote:
> > Note: reclaim_page will fix this situation direct it is allowed to
> > run since it is kicked in __alloc_pages. But since we cannot
> > guarantee that this will never happen...
>
> In this case kreclaimd will be woken up and the free pages
> will be refilled.
>
> Rik
Yes it will be woken up - but when will it actually do something?
(we might have lots of stuff before in the run queue)
Suppose we are at low for all zones on free pages - the natural.
And we get requsts for DMA pages, non direct_reclaim.
(with inactive_clean greater than pages_high)
An alloc will then take let you allocate at the first __alloc_pages_limit
until zero pages left. You might have got it anyway but not until a
later test in __alloc_pages but it is not guaranteed.
We should not accept to let free_pages go (more than one) under
pages_min, at least not as a undocumented feature of __alloc_pages_limit...
It might be worse then first tought of since all allocations with order != 0
are non direct_reclaim... you might eat the free pages fast...
And this limit at the end of alloc_pages
if (z->free_pages < z->pages_min / 4 &&
!(current->flags & PF_MEMALLOC))
is not enforced earlier in the same code...
/RogerL
--
Roger Larsson
Skelleftea
Sweden
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] __alloc_pages_limit pages_min
2001-08-22 20:58 ` Roger Larsson
@ 2001-08-22 21:10 ` Rik van Riel
0 siblings, 0 replies; 4+ messages in thread
From: Rik van Riel @ 2001-08-22 21:10 UTC (permalink / raw)
To: Roger Larsson; +Cc: linux-mm
On Wed, 22 Aug 2001, Roger Larsson wrote:
> On Wednesdayen den 22 August 2001 19:01, Rik van Riel wrote:
> > On Wed, 22 Aug 2001, Roger Larsson wrote:
> > > Note: reclaim_page will fix this situation direct it is allowed to
> > > run since it is kicked in __alloc_pages. But since we cannot
> > > guarantee that this will never happen...
> >
> > In this case kreclaimd will be woken up and the free pages
> > will be refilled.
>
> Yes it will be woken up - but when will it actually do something?
> And this limit at the end of alloc_pages
> if (z->free_pages < z->pages_min / 4 &&
> !(current->flags & PF_MEMALLOC))
> is not enforced earlier in the same code...
Please read the code. The first loop in __alloc_pages(),
before we even call __alloc_pages_limit() will wake up
kreclaimd as soon as 'z->free_pages < z->pages_min'.
If you have any more questions about the source code,
don't hesitate to ask ;)
Rik
--
IA64: a worthy successor to the i860.
http://www.surriel.com/
http://www.conectiva.com/ http://distro.conectiva.com/
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-08-22 21:11 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-22 15:12 [PATCH] __alloc_pages_limit pages_min Roger Larsson
2001-08-22 17:01 ` Rik van Riel
2001-08-22 20:58 ` Roger Larsson
2001-08-22 21:10 ` Rik van Riel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox