lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Mon, 26 Mar 2007 11:23:18 -0700 (PDT)
From:	Christoph Lameter <clameter@....com>
To:	ak@...e.de
cc:	akpm@...ux-foundation.org, linux-kernel@...r.kernel.org
Subject: [x86_64] Use lru instead of page->index and page->private for pgd
 lists management.

x86_64 currently simulates a list using the index and private fields of the page struct.
Seems that the code was inherited from i386. But x86_64 does not use the slab to
allocate pgds and pmds etc. So the lru field is not used by the slab and therefore
available.

This patch uses standard list operations on page->lru to realize pgd tracking.

Signed-off-by: Christoph Lameter <clameter@....com>

Index: linux-2.6.21-rc4/arch/x86_64/mm/fault.c
===================================================================
--- linux-2.6.21-rc4.orig/arch/x86_64/mm/fault.c	2007-03-26 11:03:46.000000000 -0700
+++ linux-2.6.21-rc4/arch/x86_64/mm/fault.c	2007-03-26 11:04:43.000000000 -0700
@@ -585,7 +585,7 @@
 }
 
 DEFINE_SPINLOCK(pgd_lock);
-struct page *pgd_list;
+LIST_HEAD(pgd_list);
 
 void vmalloc_sync_all(void)
 {
@@ -605,8 +605,7 @@
 			if (pgd_none(*pgd_ref))
 				continue;
 			spin_lock(&pgd_lock);
-			for (page = pgd_list; page;
-			     page = (struct page *)page->index) {
+			list_for_each_entry(page, &pgd_list, lru) {
 				pgd_t *pgd;
 				pgd = (pgd_t *)page_address(page) + pgd_index(address);
 				if (pgd_none(*pgd))
Index: linux-2.6.21-rc4/include/asm-x86_64/pgtable.h
===================================================================
--- linux-2.6.21-rc4.orig/include/asm-x86_64/pgtable.h	2007-03-26 11:03:46.000000000 -0700
+++ linux-2.6.21-rc4/include/asm-x86_64/pgtable.h	2007-03-26 11:04:43.000000000 -0700
@@ -403,7 +403,7 @@
 #define __swp_entry_to_pte(x)		((pte_t) { (x).val })
 
 extern spinlock_t pgd_lock;
-extern struct page *pgd_list;
+extern struct list_head pgd_list;
 void vmalloc_sync_all(void);
 
 #endif /* !__ASSEMBLY__ */
Index: linux-2.6.21-rc4/include/asm-x86_64/pgalloc.h
===================================================================
--- linux-2.6.21-rc4.orig/include/asm-x86_64/pgalloc.h	2007-03-26 11:04:52.000000000 -0700
+++ linux-2.6.21-rc4/include/asm-x86_64/pgalloc.h	2007-03-26 11:08:11.000000000 -0700
@@ -45,24 +45,16 @@
 	struct page *page = virt_to_page(pgd);
 
 	spin_lock(&pgd_lock);
-	page->index = (pgoff_t)pgd_list;
-	if (pgd_list)
-		pgd_list->private = (unsigned long)&page->index;
-	pgd_list = page;
-	page->private = (unsigned long)&pgd_list;
+	list_add(&page->lru, &pgd_list);
 	spin_unlock(&pgd_lock);
 }
 
 static inline void pgd_list_del(pgd_t *pgd)
 {
-	struct page *next, **pprev, *page = virt_to_page(pgd);
+	struct page *page = virt_to_page(pgd);
 
 	spin_lock(&pgd_lock);
-	next = (struct page *)page->index;
-	pprev = (struct page **)page->private;
-	*pprev = next;
-	if (next)
-		next->private = (unsigned long)pprev;
+	list_del(&page->lru);
 	spin_unlock(&pgd_lock);
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ