Skip to contentSkip to conversation

prefault optimization

RFC Adam Litke 1 participant 1 message Aug 15, 2003

Subsystems (2)
lore
Share & tools
lore

Adam Litke

author
#0 lore raw

Here is the latest on the pre-fault code I posted last week. I fixed it up some in response to comments I received. There is still a bug which causes some programs to segfault (ie. gcc). Interestingly, man fails the first time it is run, but subsequent runs are successful. Please take a look and let me know what you think. Any ideas about that bug?

Quoted 1 line · Andrew Morton

I'd like to see it using find_get_pages() though.

This implementation is simple but somewhat wasteful. My basic testing shows around 30% of pages returned from find_get_pages() aren't used.

Quoted 1 line

And find a way to hold the pte page's atomic kmap across the whole pte > page

I allocate the page once at the beginning but have to drop it when I need to allocate a pte_chain. Perhaps it could be done a better way.

Quoted 1 line

Perhaps it can use install_page() as well, rather than open-coding it?

It seems that install_page does too much for what I need. For starters it zaps the pte. There is also no need to do the pgd lookup stuff every time because I already know the correct pte entry to use.

Quoted 2 lines

Cannot do a sleeping allocation while holding the atomic kmap from pte_offset_map().

I took a dirty approach to this one. Is it ok to hold the page_table_lock throughout this function?

Quoted 1 line

And the pte_chain handling can be optimised:

I think I am pretty close here. In my brief test 10% of mapped pages required a call to pte_chain_alloc.

--Adam

include/asm-i386/pgtable.h +3 -0
diff -urN linux-2.5.73-virgin/include/asm-i386/pgtable.h linux-2.5.73-vm/include/asm-i386/pgtable.h
@@ -299,12 +299,15 @@
 	((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0) + pte_index(address))
 #define pte_offset_map_nested(dir, address) \
 	((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE1) + pte_index(address))
+#define pte_base_map(dir) \
+	((pte_t *)kmap_atomic(pmd_page(*(dir)),KM_PTE0)
 #define pte_unmap(pte) kunmap_atomic(pte, KM_PTE0)
 #define pte_unmap_nested(pte) kunmap_atomic(pte, KM_PTE1)
 #else
 #define pte_offset_map(dir, address) \
 	((pte_t *)page_address(pmd_page(*(dir))) + pte_index(address))
 #define pte_offset_map_nested(dir, address) pte_offset_map(dir, address)
+#define pte_base_map(dir) ((pte_t *)page_address(pmd_page(*(dir))))
 #define pte_unmap(pte) do { } while (0)
 #define pte_unmap_nested(pte) do { } while (0)
 #endif
mm/memory.c +70 -0

82 lines not on this page · raw message

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>