From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: linux-kernel <linux-kernel@vger.kernel.org>,
Linux Memory Management <linux-mm@kvack.org>
Subject: [patch 1] mm: PG_free flag
Date: Mon, 27 Jun 2005 16:32:07 +1000 [thread overview]
Message-ID: <42BF9D67.10509@yahoo.com.au> (raw)
In-Reply-To: <42BF9CD1.2030102@yahoo.com.au>
[-- Attachment #1: Type: text/plain, Size: 28 bytes --]
--
SUSE Labs, Novell Inc.
[-- Attachment #2: mm-PG_free-flag.patch --]
[-- Type: text/plain, Size: 2886 bytes --]
In a future patch we can no longer rely on page_count being stable at any
time, so we can no longer overload PagePrivate && page_count == 0 to mean
the page is free and on the buddy lists.
Index: linux-2.6/include/linux/page-flags.h
===================================================================
--- linux-2.6.orig/include/linux/page-flags.h
+++ linux-2.6/include/linux/page-flags.h
@@ -76,6 +76,8 @@
#define PG_nosave_free 18 /* Free, should not be written */
#define PG_uncached 19 /* Page has been mapped as uncached */
+#define PG_free 20 /* Page is on the free lists */
+
/*
* Global page accounting. One instance per CPU. Only unsigned longs are
* allowed.
@@ -306,6 +308,10 @@ extern void __mod_page_state(unsigned lo
#define SetPageUncached(page) set_bit(PG_uncached, &(page)->flags)
#define ClearPageUncached(page) clear_bit(PG_uncached, &(page)->flags)
+#define PageFree(page) test_bit(PG_free, &(page)->flags)
+#define __SetPageFree(page) __set_bit(PG_free, &(page)->flags)
+#define __ClearPageFree(page) __clear_bit(PG_free, &(page)->flags)
+
struct page; /* forward declaration */
int test_clear_page_dirty(struct page *page);
Index: linux-2.6/mm/page_alloc.c
===================================================================
--- linux-2.6.orig/mm/page_alloc.c
+++ linux-2.6/mm/page_alloc.c
@@ -114,7 +114,8 @@ static void bad_page(const char *functio
1 << PG_slab |
1 << PG_swapcache |
1 << PG_writeback |
- 1 << PG_reserved );
+ 1 << PG_reserved |
+ 1 << PG_free );
set_page_count(page, 0);
reset_page_mapcount(page);
page->mapping = NULL;
@@ -191,12 +192,12 @@ static inline unsigned long page_order(s
static inline void set_page_order(struct page *page, int order) {
page->private = order;
- __SetPagePrivate(page);
+ __SetPageFree(page);
}
static inline void rmv_page_order(struct page *page)
{
- __ClearPagePrivate(page);
+ __ClearPageFree(page);
page->private = 0;
}
@@ -242,9 +243,7 @@ __find_combined_index(unsigned long page
*/
static inline int page_is_buddy(struct page *page, int order)
{
- if (PagePrivate(page) &&
- (page_order(page) == order) &&
- page_count(page) == 0)
+ if (PageFree(page) && (page_order(page) == order))
return 1;
return 0;
}
@@ -327,7 +326,8 @@ static inline void free_pages_check(cons
1 << PG_slab |
1 << PG_swapcache |
1 << PG_writeback |
- 1 << PG_reserved )))
+ 1 << PG_reserved |
+ 1 << PG_free )))
bad_page(function, page);
if (PageDirty(page))
__ClearPageDirty(page);
@@ -456,7 +456,8 @@ static void prep_new_page(struct page *p
1 << PG_slab |
1 << PG_swapcache |
1 << PG_writeback |
- 1 << PG_reserved )))
+ 1 << PG_reserved |
+ 1 << PG_free )))
bad_page(__FUNCTION__, page);
page->flags &= ~(1 << PG_uptodate | 1 << PG_error |
next prev parent reply other threads:[~2005-06-27 6:32 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-27 6:29 [rfc] lockless pagecache Nick Piggin
2005-06-27 6:32 ` Nick Piggin [this message]
2005-06-27 6:32 ` [patch 2] mm: speculative get_page Nick Piggin
2005-06-27 6:33 ` [patch 3] radix tree: lookup_slot Nick Piggin
2005-06-27 6:34 ` [patch 4] radix tree: lockless readside Nick Piggin
2005-06-27 6:34 ` [patch 5] mm: lockless pagecache lookups Nick Piggin
2005-06-27 6:35 ` [patch 6] mm: spinlock tree_lock Nick Piggin
2005-06-27 14:12 ` [patch 2] mm: speculative get_page William Lee Irwin III
2005-06-28 0:03 ` Nick Piggin
2005-06-28 0:56 ` Nick Piggin
2005-06-28 1:22 ` William Lee Irwin III
2005-06-28 1:42 ` Nick Piggin
2005-06-28 4:06 ` William Lee Irwin III
2005-06-28 4:50 ` Nick Piggin
2005-06-28 5:08 ` [patch 2] mm: speculative get_page, " David S. Miller, Nick Piggin
2005-06-28 5:34 ` Nick Piggin
2005-06-28 14:19 ` William Lee Irwin III
2005-06-28 15:43 ` Nick Piggin
2005-06-28 17:01 ` Christoph Lameter
2005-06-28 23:10 ` Nick Piggin
2005-06-28 21:32 ` Jesse Barnes
2005-06-28 22:17 ` Christoph Lameter
2005-06-28 12:45 ` Andy Whitcroft
2005-06-28 13:16 ` Nick Piggin
2005-06-28 16:02 ` Dave Hansen
2005-06-29 16:31 ` Pavel Machek
2005-06-29 18:43 ` Dave Hansen
2005-06-29 21:22 ` Pavel Machek
2005-06-29 16:31 ` Pavel Machek
2005-06-27 6:43 ` VFS scalability (was: [rfc] lockless pagecache) Nick Piggin
2005-06-27 7:13 ` Andi Kleen
2005-06-27 7:33 ` VFS scalability Nick Piggin
2005-06-27 7:44 ` Andi Kleen
2005-06-27 8:03 ` Nick Piggin
2005-06-27 7:46 ` [rfc] lockless pagecache Andrew Morton
2005-06-27 8:02 ` Nick Piggin
2005-06-27 8:15 ` Andrew Morton
2005-06-27 8:28 ` Nick Piggin
2005-06-27 8:56 ` Lincoln Dale
2005-06-27 9:04 ` Nick Piggin
2005-06-27 18:14 ` Chen, Kenneth W
2005-06-27 18:50 ` Badari Pulavarty
2005-06-27 19:05 ` Chen, Kenneth W
2005-06-27 19:22 ` Christoph Lameter
2005-06-27 19:42 ` Chen, Kenneth W
2005-07-05 15:11 ` Sonny Rao
2005-07-05 15:31 ` Martin J. Bligh
2005-07-05 15:37 ` Sonny Rao
2005-06-27 13:17 ` Benjamin LaHaise
2005-06-28 0:32 ` Nick Piggin
2005-06-28 1:26 ` William Lee Irwin III
2005-06-27 14:08 ` Martin J. Bligh
2005-06-27 17:49 ` Christoph Lameter
2005-06-29 10:49 ` Hirokazu Takahashi
2005-06-29 11:38 ` Nick Piggin
2005-06-30 3:32 ` Hirokazu Takahashi
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=42BF9D67.10509@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox