diff options
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 47 |
1 files changed, 14 insertions, 33 deletions
diff --git a/mm/memory.c b/mm/memory.c index 1b8ca160f1d..1d803c2d018 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1998,45 +1998,26 @@ int vmtruncate_range(struct inode *inode, loff_t offset, loff_t end) */ void swapin_readahead(swp_entry_t entry, unsigned long addr,struct vm_area_struct *vma) { -#ifdef CONFIG_NUMA - struct vm_area_struct *next_vma = vma ? vma->vm_next : NULL; -#endif - int i, num; - struct page *new_page; + int nr_pages; + struct page *page; unsigned long offset; + unsigned long end_offset; /* - * Get the number of handles we should do readahead io to. + * Get starting offset for readaround, and number of pages to read. + * Adjust starting address by readbehind (for NUMA interleave case)? + * No, it's very unlikely that swap layout would follow vma layout, + * more likely that neighbouring swap pages came from the same node: + * so use the same "addr" to choose the same node for each swap read. */ - num = valid_swaphandles(entry, &offset); - for (i = 0; i < num; offset++, i++) { + nr_pages = valid_swaphandles(entry, &offset); + for (end_offset = offset + nr_pages; offset < end_offset; offset++) { /* Ok, do the async read-ahead now */ - new_page = read_swap_cache_async(swp_entry(swp_type(entry), - offset), vma, addr); - if (!new_page) + page = read_swap_cache_async(swp_entry(swp_type(entry), offset), + vma, addr); + if (!page) break; - page_cache_release(new_page); -#ifdef CONFIG_NUMA - /* - * Find the next applicable VMA for the NUMA policy. - */ - addr += PAGE_SIZE; - if (addr == 0) - vma = NULL; - if (vma) { - if (addr >= vma->vm_end) { - vma = next_vma; - next_vma = vma ? vma->vm_next : NULL; - } - if (vma && addr < vma->vm_start) - vma = NULL; - } else { - if (next_vma && addr >= next_vma->vm_start) { - vma = next_vma; - next_vma = vma->vm_next; - } - } -#endif + page_cache_release(page); } lru_add_drain(); /* Push any new pages onto the LRU now */ } |