High order memory allocations (was Re: Memory Problem in 2.4.10-pre2 / __alloc_pages failed)

From: Alex Bligh - linux-kernel (linux-kernel@alex.org.uk)
Date: Sun Sep 02 2001 - 17:36:07 EST


Next problem / idea:

memory_pressure sets the target for inactive_target (hence
free_target etc.)

However, if you do (say) and order 5 allocation, memory
pressure is only incremented by 1. This seems illogical,
especially given __alloc_pages does not loop via
try_again, on order>0 allocations (except
when freeshortage() is true) even if __GFP_WAIT
is set (I suspect because it just sits there for
ever). In practice, this means page_launder only
has one shot at freeing sufficient pages, and this
with a wrong inactive target. I propose something
like (whitespace broken - sorry):

--- mm/page_alloc.c.keep Sun Sep 2 23:32:56 2001
+++ mm/page_alloc.c Sun Sep 2 23:34:03 2001
@@ -141,8 +141,8 @@
         * since it's nothing important, but we do want to make sure
         * it never gets negative.
         */
- if (memory_pressure > NR_CPUS)
- memory_pressure--;
+ if (memory_pressure > (NR_CPUS << order))
+ memory_pressure-= 1<<order;
 }

 #define MARK_USED(index, order, area) \
@@ -288,7 +288,7 @@
        /*
         * Allocations put pressure on the VM subsystem.
         */
- memory_pressure++;
+ memory_pressure+= 1<<order;

        /*
         * (If anyone calls gfp from interrupts nonatomically then it

--
Alex Bligh
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Sep 07 2001 - 21:00:16 EST