* [PATCH] Revised fix for show_mem panic
@ 2004-03-15 12:33 John Marvin
0 siblings, 0 replies; 2+ messages in thread
From: John Marvin @ 2004-03-15 12:33 UTC (permalink / raw)
To: linux-ia64
--- a/arch/ia64/mm/contig.c Fri Mar 12 07:17:21 2004
+++ b/arch/ia64/mm/contig.c Fri Mar 12 05:59:24 2004
@@ -46,6 +46,8 @@
printk("Free swap: %6dkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
i = max_mapnr;
while (i-- > 0) {
+ if (!pfn_valid(i))
+ continue;
total++;
if (PageReserved(mem_map+i))
reserved++;
--- a/arch/ia64/mm/discontig.c Fri Mar 12 07:17:21 2004
+++ b/arch/ia64/mm/discontig.c Fri Mar 12 06:15:26 2004
@@ -377,6 +377,8 @@
for_each_pgdat(pgdat) {
printk("Node ID: %d\n", pgdat->node_id);
for(i = 0; i < pgdat->node_spanned_pages; i++) {
+ if (!ia64_pfn_valid(pgdat->node_start_pfn+i))
+ continue;
if (PageReserved(pgdat->node_mem_map+i))
reserved++;
else if (PageSwapCache(pgdat->node_mem_map+i))
--- a/arch/ia64/mm/init.c Fri Mar 12 07:17:21 2004
+++ b/arch/ia64/mm/init.c Mon Mar 15 04:55:08 2004
@@ -455,8 +455,11 @@
ia64_pfn_valid (unsigned long pfn)
{
char byte;
+ struct page *pg = pfn_to_page(pfn);
- return __get_user(byte, (char *) pfn_to_page(pfn)) = 0;
+ return (__get_user(byte, (char *) pg) = 0)
+ && ((((u64)pg & PAGE_MASK) = (((u64)(pg + 1) - 1) & PAGE_MASK))
+ || (__get_user(byte, (char *) (pg + 1) - 1) = 0));
}
EXPORT_SYMBOL(ia64_pfn_valid);
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Revised fix for show_mem panic
@ 2004-03-15 12:40 John Marvin
0 siblings, 0 replies; 2+ messages in thread
From: John Marvin @ 2004-03-15 12:40 UTC (permalink / raw)
To: linux-ia64
Oops. Usually I forget to include the patch. This time I sent the patch
without the intro text:
> Would it make sense to do only the first __get_user() _unless_ the
> "struct page" crosses a page?
Most likely. Although code that calls ia64_pfn_valid is going to be
dereferencing the page structure anyway, a page structure will always
cross a 1st level cache line, and will often cross a second level
cache line. The code may or may not touch both parts of the the
structure, so the test may prevent an unecessary cache line load,
and it won't take that many cycles to test for the case.
John
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-03-15 12:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-15 12:40 [PATCH] Revised fix for show_mem panic John Marvin
-- strict thread matches above, loose matches on Subject: below --
2004-03-15 12:33 John Marvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox