Skip to contentSkip to conversation

futex-2.5.40-B5

PATCH Oleg Nesterov 2 participants 2 messages Oct 4, 2002 – Oct 5, 2002

lore
Share & tools
lore
#0 lore raw

Hello.

Quoted 2 lines · Ingo Molnar

the new lookup code first does a lightweight follow_page(), then if no page is present we do the get_user_pages() thing.

What if futex placed in VM_HUGETLB area?
Then follow_page() return garbage.

I beleive in i386 case it can be fixed something like this:

memory.c renamed from memory.c.orig +11 -0
@@ -480,6 +480,17 @@ follow_page(struct mm_struct *mm, unsign
 	if (pmd_none(*pmd) || pmd_bad(*pmd))
 		goto out;
 
+#ifdef	CONFIG_HUGETLB_PAGE
+	if (pmd_large(pmd)) {
+		ptep = (pte_t *) pmd;
+
+		if (write && !pte_write(*ptep))
+			return NULL;
+
+		return pte_page(*ptep) + ((address & ~HPAGE_MASK) >> PAGE_SHIFT);
+	}
+#endif
+
 	ptep = pte_offset_map(pmd, address);
 	if (!ptep)
 		goto out;

Then follow_hugetlb_page() hook can be killed.

Oleg.

#1 lore raw

In article <[email protected]>,

Quoted 10 lines · Oleg Nesterov

Hello.

Quoted 2 lines · Ingo Molnar

the new lookup code first does a lightweight follow_page(), then if no page is present we do the get_user_pages() thing.

What if futex placed in VM_HUGETLB area?
Then follow_page() return garbage.

I beleive in i386 case it can be fixed something like this:

This will fix it for i386, but will break it for all other architectures, as you're now depending on a x86-specific implementation detail in an arch-independent file using a generic CONFIG test..

Quoted 1 line

Then follow_hugetlb_page() hook can be killed.

I'd much rather have a hook that works, than having #ifdef's in code that don't..

Linus