Re: [patch] balanced highmem subsystem under pre7-9

From: Linus Torvalds (
Date: Fri May 12 2000 - 14:06:13 EST

On Fri, 12 May 2000, Ingo Molnar wrote:
> i initially tested pre7-9 and it showed bad behavior: high kswapd activity
> trying to balance highmem, while the pagecache is primarily filled from
> the highmem. I dont think this can be fixed without 'silencing'
> ZONE_HIGHMEM's balancing activities: the pagecache allocates from highmem
> so it puts direct pressure on the highmem zone.

If this is true, then that is a bug in the allocator.

I tried very hard (but must obviously have failed), to make the allocator
_always_ do the right thing - never allocating from a zone that causes
memory balancing if there is another zone that is preferable.

> This had two effects: wasted CPU time, but it also limited the
> page-cache's maximum size to the size of highmem. I'll try the final
> pre7-2.3.99 kernel as well in a minute to make sure. (i think the bad
> behavior is still be there, judging from the differences between pre9 and
> the final patch.)

Please fix the memory allocator instead. It should really go to the next
zone instead of allocating more from the highmem zone.

Actually, I think the real bug is kswapd - I thought the "for (;;)" loop
was a good idea, but I've since actually thought about it more, and in
real life we really just want to go to sleep when we need to re-schedule,
because if there is any _real_ memory pressure people _will_ wake us up
anyway. So before you touch the memory allocator logic, you might want to
change the

        if (tsk->need_resched)

to a

        if (tsk->need_resched)
                goto sleep;

(and add a "sleep:" thing to inside the if-statement that makes us go to
sleep). That way, if we end up scheduling away from kswapd, we won't waste
time scheduling back unless we really should.

But do check out __alloc_pages() too, maybe you see some obvious bug of
mine that I just never thought about.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon May 15 2000 - 21:00:21 EST