patch-2.3.7 linux/mm/page_alloc.c
Next file: linux/mm/page_io.c
Previous file: linux/mm/mmap.c
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Sun Jun 20 16:00:24 1999
- Orig file:
v2.3.6/linux/mm/page_alloc.c
- Orig date:
Tue May 11 14:37:40 1999
diff -u --recursive --new-file v2.3.6/linux/mm/page_alloc.c linux/mm/page_alloc.c
@@ -119,33 +119,33 @@
spin_unlock_irqrestore(&page_alloc_lock, flags);
}
-void __free_page(struct page *page)
+int __free_page(struct page *page)
{
- if (!PageReserved(page) && atomic_dec_and_test(&page->count)) {
+ if (!PageReserved(page) && put_page_testzero(page)) {
if (PageSwapCache(page))
- panic ("Freeing swap cache page");
+ PAGE_BUG(page);
page->flags &= ~(1 << PG_referenced);
free_pages_ok(page - mem_map, 0);
- return;
+ return 1;
}
+ return 0;
}
-void free_pages(unsigned long addr, unsigned long order)
+int free_pages(unsigned long addr, unsigned long order)
{
unsigned long map_nr = MAP_NR(addr);
if (map_nr < max_mapnr) {
mem_map_t * map = mem_map + map_nr;
- if (PageReserved(map))
- return;
- if (atomic_dec_and_test(&map->count)) {
+ if (!PageReserved(map) && put_page_testzero(map)) {
if (PageSwapCache(map))
- panic ("Freeing swap cache pages");
+ PAGE_BUG(map);
map->flags &= ~(1 << PG_referenced);
free_pages_ok(map_nr, order);
- return;
+ return 1;
}
}
+ return 0;
}
/*
@@ -167,7 +167,7 @@
MARK_USED(map_nr, new_order, area); \
nr_free_pages -= 1 << order; \
EXPAND(ret, map_nr, order, new_order, area); \
- spin_unlock_irqrestore(&page_alloc_lock, flags); \
+ spin_unlock_irqrestore(&page_alloc_lock,flags);\
return ADDRESS(map_nr); \
} \
prev = ret; \
@@ -186,7 +186,7 @@
index += size; \
map += size; \
} \
- atomic_set(&map->count, 1); \
+ set_page_count(map, 1); \
} while (0)
int low_on_memory = 0;
@@ -321,7 +321,7 @@
memset(mem_map, 0, start_mem - (unsigned long) mem_map);
do {
--p;
- atomic_set(&p->count, 0);
+ set_page_count(p, 0);
p->flags = (1 << PG_DMA) | (1 << PG_reserved);
init_waitqueue_head(&p->wait);
} while (p > mem_map);
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)