From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>
Cc: Linux Memory Management <linux-mm@kvack.org>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: [RFC][PATCH 1/3] account free buddy areas
Date: Sun, 05 Sep 2004 15:45:28 +1000 [thread overview]
Message-ID: <413AA7F8.3050706@yahoo.com.au> (raw)
In-Reply-To: <413AA7B2.4000907@yahoo.com.au>
[-- Attachment #1: Type: text/plain, Size: 4 bytes --]
1/3
[-- Attachment #2: vm-free-order-pages.patch --]
[-- Type: text/x-patch, Size: 3398 bytes --]
Keep track of the number of free pages of each order in the buddy allocator.
Signed-off-by: Nick Piggin <nickpiggin@yahoo.com.au>
---
linux-2.6-npiggin/include/linux/mmzone.h | 1 +
linux-2.6-npiggin/mm/page_alloc.c | 22 ++++++++--------------
2 files changed, 9 insertions(+), 14 deletions(-)
diff -puN mm/page_alloc.c~vm-free-order-pages mm/page_alloc.c
--- linux-2.6/mm/page_alloc.c~vm-free-order-pages 2004-09-05 14:53:53.000000000 +1000
+++ linux-2.6-npiggin/mm/page_alloc.c 2004-09-05 14:53:53.000000000 +1000
@@ -216,6 +216,7 @@ static inline void __free_pages_bulk (st
page_idx &= mask;
}
list_add(&(base + page_idx)->lru, &area->free_list);
+ area->nr_free++;
}
static inline void free_pages_check(const char *function, struct page *page)
@@ -317,6 +318,7 @@ expand(struct zone *zone, struct page *p
size >>= 1;
BUG_ON(bad_range(zone, &page[size]));
list_add(&page[size].lru, &area->free_list);
+ area->nr_free++;
MARK_USED(index + size, high, area);
}
return page;
@@ -380,6 +382,7 @@ static struct page *__rmqueue(struct zon
page = list_entry(area->free_list.next, struct page, lru);
list_del(&page->lru);
+ area->nr_free--;
index = page - zone->zone_mem_map;
if (current_order != MAX_ORDER-1)
MARK_USED(index, current_order, area);
@@ -1228,7 +1231,6 @@ void show_free_areas(void)
}
for_each_zone(zone) {
- struct list_head *elem;
unsigned long nr, flags, order, total = 0;
show_node(zone);
@@ -1240,9 +1242,7 @@ void show_free_areas(void)
spin_lock_irqsave(&zone->lock, flags);
for (order = 0; order < MAX_ORDER; order++) {
- nr = 0;
- list_for_each(elem, &zone->free_area[order].free_list)
- ++nr;
+ nr = zone->free_area[order].nr_free;
total += nr << order;
printk("%lu*%lukB ", nr, K(1UL) << order);
}
@@ -1569,6 +1569,7 @@ void zone_init_free_lists(struct pglist_
bitmap_size = pages_to_bitmap_size(order, size);
zone->free_area[order].map =
(unsigned long *) alloc_bootmem_node(pgdat, bitmap_size);
+ zone->free_area[order].nr_free = 0;
}
}
@@ -1756,8 +1757,7 @@ static void frag_stop(struct seq_file *m
}
/*
- * This walks the freelist for each zone. Whilst this is slow, I'd rather
- * be slow here than slow down the fast path by keeping stats - mjbligh
+ * This walks the free areas for each zone.
*/
static int frag_show(struct seq_file *m, void *arg)
{
@@ -1773,14 +1773,8 @@ static int frag_show(struct seq_file *m,
spin_lock_irqsave(&zone->lock, flags);
seq_printf(m, "Node %d, zone %8s ", pgdat->node_id, zone->name);
- for (order = 0; order < MAX_ORDER; ++order) {
- unsigned long nr_bufs = 0;
- struct list_head *elem;
-
- list_for_each(elem, &(zone->free_area[order].free_list))
- ++nr_bufs;
- seq_printf(m, "%6lu ", nr_bufs);
- }
+ for (order = 0; order < MAX_ORDER; ++order)
+ seq_printf(m, "%6lu ", zone->free_area[order].nr_free);
spin_unlock_irqrestore(&zone->lock, flags);
seq_putc(m, '\n');
}
diff -puN include/linux/mmzone.h~vm-free-order-pages include/linux/mmzone.h
--- linux-2.6/include/linux/mmzone.h~vm-free-order-pages 2004-09-05 14:53:53.000000000 +1000
+++ linux-2.6-npiggin/include/linux/mmzone.h 2004-09-05 14:53:53.000000000 +1000
@@ -23,6 +23,7 @@
struct free_area {
struct list_head free_list;
unsigned long *map;
+ unsigned long nr_free;
};
struct pglist_data;
_
next prev parent reply other threads:[~2004-09-05 5:46 UTC|newest]
Thread overview: 57+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-05 5:44 [RFC][PATCH 0/3] beat kswapd with the proverbial clue-bat Nick Piggin
2004-09-05 5:44 ` Nick Piggin
2004-09-05 5:45 ` Nick Piggin [this message]
2004-09-05 5:46 ` [RFC][PATCH 2/3] alloc-order watermarks Nick Piggin
2004-09-05 5:47 ` [RFC][PATCH 3/3] teach kswapd about watermarks Nick Piggin
2004-09-05 6:04 ` David S. Miller
2004-09-05 6:04 ` David S. Miller
2004-09-05 6:20 ` Nick Piggin
2004-09-05 6:20 ` Nick Piggin
2004-09-05 5:50 ` [RFC][PATCH 2/3] alloc-order watermarks Nick Piggin
2004-09-05 5:50 ` Nick Piggin
2004-09-05 6:13 ` [RFC][PATCH 1/3] account free buddy areas Nick Piggin
2004-09-05 6:13 ` Nick Piggin
2004-09-05 6:02 ` [RFC][PATCH 0/3] beat kswapd with the proverbial clue-bat David S. Miller
2004-09-05 6:02 ` David S. Miller
2004-09-05 6:16 ` Nick Piggin
2004-09-05 6:16 ` Nick Piggin
2004-09-05 10:13 ` Nick Piggin
2004-09-05 10:13 ` Nick Piggin
2004-09-05 17:24 ` Linus Torvalds
2004-09-05 17:24 ` Linus Torvalds
2004-09-05 17:36 ` Martin J. Bligh
2004-09-05 17:36 ` Martin J. Bligh
2004-09-05 17:37 ` Arjan van de Ven
2004-09-05 17:58 ` Linus Torvalds
2004-09-05 17:58 ` Linus Torvalds
2004-09-05 18:41 ` Arjan van de Ven
2004-09-06 1:35 ` Nick Piggin
2004-09-06 1:35 ` Nick Piggin
2004-09-15 13:27 ` Jörn Engel
2004-09-15 13:27 ` Jörn Engel
2004-09-15 13:29 ` Arjan van de Ven
2004-09-15 13:34 ` Jörn Engel
2004-09-15 13:34 ` Jörn Engel
2004-09-15 13:39 ` Arjan van de Ven
2004-09-15 14:18 ` Jörn Engel
2004-09-15 14:18 ` Jörn Engel
2004-09-06 1:09 ` Nick Piggin
2004-09-06 1:09 ` Nick Piggin
2004-09-05 6:09 ` Andrew Morton
2004-09-05 6:09 ` Andrew Morton
2004-09-05 6:26 ` Nick Piggin
2004-09-05 6:26 ` Nick Piggin
2004-09-05 6:27 ` Anton Blanchard
2004-09-05 6:27 ` Anton Blanchard
2004-09-05 10:09 ` Nick Piggin
2004-09-05 10:09 ` Nick Piggin
2004-09-06 3:33 ` David S. Miller
2004-09-06 3:33 ` David S. Miller
2004-09-06 8:55 ` Nick Piggin
2004-09-06 8:55 ` Nick Piggin
2004-09-05 16:49 ` Linus Torvalds
2004-09-05 16:49 ` Linus Torvalds
2004-09-06 0:54 ` Nick Piggin
2004-09-06 0:54 ` Nick Piggin
2004-09-06 1:49 ` Nick Piggin
2004-09-06 1:49 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=413AA7F8.3050706@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.