diff -u linux-2.5.46-ioe/mm/memory.c linux-2.5.46-ioe/mm/memory.c --- linux-2.5.46-ioe/mm/memory.c Tue Nov 5 22:43:38 2002 +++ linux-2.5.46-ioe/mm/memory.c Wed Nov 6 00:24:05 2002 @@ -689,16 +689,16 @@ if (!vma || (vma->vm_flags & VM_IO) || !(flags & vma->vm_flags)) return ERR_PTR(EFAULT); - /* FIXME: These are not handled properly, yet. -ioe */ - /* - if (is_vm_hugetlb_page(vma)) { - int len = 1; - int i; - i = follow_hugetlb_page(mm, vma, &page, NULL, - &start, &len, 0); - return (i == 1) ? page : ERR_PTR(EFAULT); - } - */ + if (is_vm_hugetlb_page(vma)) { + struct gup_add_pages gup = { + .count = 0, + .max_pages = 1, + .pages = &page, + }; + int ret; + ret = follow_hugetlb_page(mm, vma, &start, gup_add_pages, &gup); + return (ret == 0) ? page : ERR_PTR(ret); + } spin_lock(&mm->page_table_lock); page = single_page_walk(tsk, mm, vma, start, write); @@ -710,15 +710,12 @@ return page; } -#ifdef CONFIG_HUGETLB_PAGE -#error This code is not suitable for huge pages yet. -#endif - /* Returns 0 or negative errno value */ int walk_user_pages(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, int write, int force, custom_page_walker_t walker, void *customdata) { + int ret = 0; unsigned int flags; /* @@ -738,18 +735,18 @@ return walker(ERR_PTR(EFAULT), ERR_PTR(EFAULT), start, customdata); - /* FIXME: These are not handled, yet. -ioe */ - /* - if (is_vm_hugetlb_page(vma)) { - int i=0; - i = follow_hugetlb_page(mm, vma, pages, vmas, - &start, &len, i); - continue; - } - */ + if (is_vm_hugetlb_page(vma)) { + ret = follow_hugetlb_page(mm, vma, &start, + walker, customdata); + + if (ret == 0) + continue; + else + break; + } + spin_lock(&mm->page_table_lock); do { - int ret; struct page *page; page = single_page_walk(tsk, mm, vma, start, write); ret = walker(vma, page, start, customdata); @@ -774,9 +771,7 @@ } while (start < vma->vm_end); spin_unlock(&mm->page_table_lock); } while(1); - - /* We will never reach this code, but this makes GCC happy */ - return 0; + return ret; }