Messages in this thread Patch in this message | | | Date | Wed, 14 Jul 2004 23:06:54 +0900 (JST) | Subject | [PATCH] memory hotremoval for linux-2.6.7 [16/16] | From | Hirokazu Takahashi <> |
| |
--- linux-2.6.7.ORG/fs/direct-io.c Thu Jun 17 15:17:13 2032 +++ linux-2.6.7/fs/direct-io.c Thu Jun 17 15:28:44 2032 @@ -27,6 +27,7 @@ #include <linux/slab.h> #include <linux/highmem.h> #include <linux/pagemap.h> +#include <linux/hugetlb.h> #include <linux/bio.h> #include <linux/wait.h> #include <linux/err.h> @@ -110,7 +111,11 @@ struct dio { * Page queue. These variables belong to dio_refill_pages() and * dio_get_page(). */ +#ifndef CONFIG_HUGETLB_PAGE struct page *pages[DIO_PAGES]; /* page buffer */ +#else + struct page *pages[HPAGE_SIZE/PAGE_SIZE]; /* page buffer */ +#endif unsigned head; /* next page to process */ unsigned tail; /* last valid page + 1 */ int page_errors; /* errno from get_user_pages() */ @@ -143,9 +148,20 @@ static int dio_refill_pages(struct dio * { int ret; int nr_pages; + struct vm_area_struct * vma; - nr_pages = min(dio->total_pages - dio->curr_page, DIO_PAGES); down_read(¤t->mm->mmap_sem); +#ifdef CONFIG_HUGETLB_PAGE + vma = find_vma(current->mm, dio->curr_user_address); + if (vma && is_vm_hugetlb_page(vma)) { + unsigned long n = dio->curr_user_address & PAGE_MASK; + n = (n & ~HPAGE_MASK) >> PAGE_SHIFT; + n = HPAGE_SIZE/PAGE_SIZE - n; + nr_pages = min(dio->total_pages - dio->curr_page, (int)n); + } else +#endif + nr_pages = min(dio->total_pages - dio->curr_page, DIO_PAGES); + ret = get_user_pages( current, /* Task for fault acounting */ current->mm, /* whose pages? */ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |