Index: mm/page_alloc.c =================================================================== RCS file: /home/dot1/blah/cvs/linux/linux/mm/page_alloc.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 page_alloc.c --- page_alloc.c 1997/07/19 01:23:44 1.1.1.1 +++ page_alloc.c 1997/07/19 23:51:53 @@ -3,6 +3,7 @@ * * Copyright (C) 1991, 1992, 1993, 1994 Linus Torvalds * Swap reorganised 29.12.95, Stephen Tweedie + * New page allocation 27.1.96 Benjamin LaHaise */ #include @@ -56,6 +57,11 @@ static struct free_area_struct free_area[NR_MEM_LISTS]; +#ifdef PARANOID_CHECKS +volatile static unsigned long pages_allocated[NR_MEM_LISTS = {0,}; /*HERE!*/ +volatile static unsigned long merges = 0; +#endif + static inline void init_mem_queue(struct free_area_struct * head) { head->next = memory_head(head); @@ -70,6 +76,9 @@ entry->next = next; next->prev = entry; head->next = entry; +#ifdef PARANOID_CHECKS + entry->head_magic = MEM_CHUNK_HEAD_MAGIC; +#endif } static inline void remove_mem_queue(struct page * entry) @@ -78,6 +87,11 @@ struct page * prev = entry->prev; next->prev = prev; prev->next = next; +#ifdef PARANOID_CHECKS + if (MEM_CHUNK_HEAD_MAGIC != entry->head_magic) + printk(KERN_DEBUG "remove_mem_queue: entry head_magic check failed (%p)\n", entry); + entry->head_magic = 0; +#endif } /* @@ -154,6 +168,16 @@ } } +static inline void mark_used ( unsigned long addr, unsigned long order ) +{ + struct page *map = mem_map + MAP_NR(addr); + unsigned long num = 1 << order; + while (num--) { + map->age = PAGE_INITIAL_AGE; + map++->count = 1; + } +} + /* * Some ugly macros to speed up __get_free_pages().. */ @@ -194,6 +218,11 @@ map->age = PAGE_INITIAL_AGE; \ } while (0) +static inline unsigned long rmqueue(unsigned long order, int dma) +{ + +} + unsigned long __get_free_pages(int priority, unsigned long order, int dma) { unsigned long flags; @@ -205,10 +234,10 @@ if (in_interrupt() && priority != GFP_ATOMIC) { static int count = 0; if (++count < 5) { - printk("gfp called nonatomically from interrupt %p\n", + printk(KERN_DEBUG "gfp called nonatomically from interrupt %p\n", __builtin_return_address(0)); - priority = GFP_ATOMIC; } + priority = GFP_ATOMIC; } reserved_pages = 5; @@ -236,7 +265,9 @@ { unsigned long order, flags; unsigned long total = 0; - +#ifdef PARANOID_CHECKS + printk("Merges: %lu\n", merges); +#endif printk("Free pages: %6dkB\n ( ",nr_free_pages<<(PAGE_SHIFT-10)); spin_lock_irqsave(&page_alloc_lock, flags); for (order=0 ; order < NR_MEM_LISTS; order++) { @@ -266,7 +297,6 @@ __initfunc(unsigned long free_area_init(unsigned long start_mem, unsigned long end_mem)) { mem_map_t * p; - unsigned long mask = PAGE_MASK; int i; /*