patch-2.4.25 linux-2.4.25/mm/page_alloc.c

Next file: linux-2.4.25/mm/vmscan.c
Previous file: linux-2.4.25/mm/oom_kill.c
Back to the patch index
Back to the overall index

diff -urN linux-2.4.24/mm/page_alloc.c linux-2.4.25/mm/page_alloc.c
@@ -378,7 +378,8 @@
 
 	/* here we're in the low on memory slow path */
 
-	if (current->flags & PF_MEMALLOC && !in_interrupt()) {
+	if ((current->flags & PF_MEMALLOC) && 
+			(!in_interrupt() || (current->flags & PF_MEMDIE))) {
 		zone = zonelist->zones;
 		for (;;) {
 			zone_t *z = *(zone++);
@@ -533,6 +534,23 @@
 
 	return pages;
 }
+
+unsigned int freeable_lowmem(void)
+{
+	unsigned int pages = 0;
+	pg_data_t *pgdat;
+
+	for_each_pgdat(pgdat) {
+		pages += pgdat->node_zones[ZONE_DMA].free_pages;
+		pages += pgdat->node_zones[ZONE_DMA].nr_active_pages;
+		pages += pgdat->node_zones[ZONE_DMA].nr_inactive_pages;
+		pages += pgdat->node_zones[ZONE_NORMAL].free_pages;
+		pages += pgdat->node_zones[ZONE_NORMAL].nr_active_pages;
+		pages += pgdat->node_zones[ZONE_NORMAL].nr_inactive_pages;
+	}
+
+	return pages;
+}
 #endif
 
 #define K(x) ((x) << (PAGE_SHIFT-10))

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)