From: Christoph Lameter <clameter@sgi.com>
To: linux-kernel@vger.kernel.org
Cc: ak@suse.com, mpm@selenic.com, linux-ia64@vger.kernel.org,
holt@sgi.com, Christoph Lameter <clameter@sgi.com>
Subject: [QUICKLIST 3/6] i386: Use standard list manipulators for pgd_list
Date: Sun, 11 Mar 2007 02:09:39 +0000 [thread overview]
Message-ID: <20070311020939.19905.15885.sendpatchset@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20070311020923.19905.49260.sendpatchset@schroedinger.engr.sgi.com>
i386: Use standard list macros.
Get rid of generating a list via page->index and page->private. Use
page->lru instead.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.21-rc3/arch/i386/mm/pgtable.c
=================================--- linux-2.6.21-rc3.orig/arch/i386/mm/pgtable.c 2007-03-10 17:42:08.000000000 -0800
+++ linux-2.6.21-rc3/arch/i386/mm/pgtable.c 2007-03-10 17:44:23.000000000 -0800
@@ -213,31 +213,12 @@ struct page *pte_alloc_one(struct mm_str
* -- wli
*/
DEFINE_SPINLOCK(pgd_lock);
-struct page *pgd_list;
-
-static inline void pgd_list_add(pgd_t *pgd)
-{
- struct page *page = virt_to_page(pgd);
- page->index = (unsigned long)pgd_list;
- if (pgd_list)
- set_page_private(pgd_list, (unsigned long)&page->index);
- pgd_list = page;
- set_page_private(page, (unsigned long)&pgd_list);
-}
-
-static inline void pgd_list_del(pgd_t *pgd)
-{
- struct page *next, **pprev, *page = virt_to_page(pgd);
- next = (struct page *)page->index;
- pprev = (struct page **)page_private(page);
- *pprev = next;
- if (next)
- set_page_private(next, (unsigned long)pprev);
-}
+LIST_HEAD(pgd_list);
void pgd_ctor(void *pgd)
{
unsigned long flags;
+ struct page *page = virt_to_page(pgd);
if (PTRS_PER_PMD = 1) {
memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t));
@@ -256,7 +237,7 @@ void pgd_ctor(void *pgd)
__pa(swapper_pg_dir) >> PAGE_SHIFT,
USER_PTRS_PER_PGD, PTRS_PER_PGD - USER_PTRS_PER_PGD);
- pgd_list_add(pgd);
+ list_add(&page->lru, &pgd_list);
spin_unlock_irqrestore(&pgd_lock, flags);
}
@@ -264,10 +245,11 @@ void pgd_ctor(void *pgd)
void pgd_dtor(void *pgd)
{
unsigned long flags; /* can be called from interrupt context */
+ struct page *page = virt_to_page(pgd);
paravirt_release_pd(__pa(pgd) >> PAGE_SHIFT);
spin_lock_irqsave(&pgd_lock, flags);
- pgd_list_del(pgd);
+ list_del(&page->lru);
spin_unlock_irqrestore(&pgd_lock, flags);
}
Index: linux-2.6.21-rc3/include/asm-i386/pgtable.h
=================================--- linux-2.6.21-rc3.orig/include/asm-i386/pgtable.h 2007-03-10 17:41:48.000000000 -0800
+++ linux-2.6.21-rc3/include/asm-i386/pgtable.h 2007-03-10 17:42:00.000000000 -0800
@@ -39,7 +39,7 @@ extern pgd_t swapper_pg_dir[1024];
void check_pgt_cache(void);
extern spinlock_t pgd_lock;
-extern struct page *pgd_list;
+extern struct list_head pgd_list;
static inline void pgtable_cache_init(void) {};
void paging_init(void);
Index: linux-2.6.21-rc3/arch/i386/mm/fault.c
=================================--- linux-2.6.21-rc3.orig/arch/i386/mm/fault.c 2007-03-10 17:48:04.000000000 -0800
+++ linux-2.6.21-rc3/arch/i386/mm/fault.c 2007-03-10 17:49:30.000000000 -0800
@@ -608,11 +608,10 @@ void vmalloc_sync_all(void)
struct page *page;
spin_lock_irqsave(&pgd_lock, flags);
- for (page = pgd_list; page; page - (struct page *)page->index)
+ list_for_each_entry(page, &pgd_list, lru)
if (!vmalloc_sync_one(page_address(page),
address)) {
- BUG_ON(page != pgd_list);
+ BUG();
break;
}
spin_unlock_irqrestore(&pgd_lock, flags);
Index: linux-2.6.21-rc3/arch/i386/mm/pageattr.c
=================================--- linux-2.6.21-rc3.orig/arch/i386/mm/pageattr.c 2007-03-10 17:49:44.000000000 -0800
+++ linux-2.6.21-rc3/arch/i386/mm/pageattr.c 2007-03-10 17:50:14.000000000 -0800
@@ -95,7 +95,7 @@ static void set_pmd_pte(pte_t *kpte, uns
return;
spin_lock_irqsave(&pgd_lock, flags);
- for (page = pgd_list; page; page = (struct page *)page->index) {
+ list_for_each_entry(page, &pgd_list, lru) {
pgd_t *pgd;
pud_t *pud;
pmd_t *pmd;
next prev parent reply other threads:[~2007-03-11 2:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-11 2:09 [QUICKLIST 0/6] Arch independent quicklists V1 Christoph Lameter
2007-03-11 2:09 ` [QUICKLIST 1/6] Extract quicklist implementation from IA64 Christoph Lameter
2007-03-11 2:09 ` [QUICKLIST 2/6] i386: quicklist support Christoph Lameter
2007-03-11 3:22 ` William Lee Irwin III
2007-03-11 2:09 ` Christoph Lameter [this message]
2007-03-11 2:09 ` [QUICKLIST 4/6] x86_64: Single Quicklist Christoph Lameter
2007-03-11 7:54 ` Andi Kleen
2007-03-11 16:44 ` Christoph Lameter
2007-03-14 19:49 ` Mel Gorman
2007-03-11 2:09 ` [QUICKLIST 5/6] x86_64: Separate quicklist for pgds Christoph Lameter
2007-03-11 2:09 ` [QUICKLIST 6/6] slub: remove special casing for PAGE_SIZE slabs Christoph Lameter
2007-03-11 20:59 ` [QUICKLIST 0/6] Arch independent quicklists V1 David Miller
2007-03-12 11:12 ` Christoph Lameter
2007-03-12 11:23 ` David Miller
2007-03-12 15:52 ` Robin Holt
2007-03-12 22:51 ` David Miller
2007-03-13 0:37 ` Paul Mackerras
2007-03-13 1:38 ` Christoph Lameter
2007-03-13 2:26 ` David Miller
2007-03-13 2:32 ` David Miller
2007-03-15 7:23 ` Andrew Morton
2007-03-15 7:31 ` David Miller
2007-03-15 7:40 ` Andrew Morton
2007-03-14 0:41 ` William Lee Irwin III
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=20070311020939.19905.15885.sendpatchset@schroedinger.engr.sgi.com \
--to=clameter@sgi.com \
--cc=ak@suse.com \
--cc=holt@sgi.com \
--cc=linux-ia64@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpm@selenic.com \
/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