Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Generic hugetlb support. |
| 3 | * (C) William Irwin, April 2004 |
| 4 | */ |
| 5 | #include <linux/gfp.h> |
| 6 | #include <linux/list.h> |
| 7 | #include <linux/init.h> |
| 8 | #include <linux/module.h> |
| 9 | #include <linux/mm.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 10 | #include <linux/sysctl.h> |
| 11 | #include <linux/highmem.h> |
| 12 | #include <linux/nodemask.h> |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 13 | #include <linux/pagemap.h> |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 14 | #include <linux/mempolicy.h> |
Christoph Lameter | aea47ff | 2006-01-08 01:00:57 -0800 | [diff] [blame] | 15 | #include <linux/cpuset.h> |
David Gibson | 3935baa | 2006-03-22 00:08:53 -0800 | [diff] [blame] | 16 | #include <linux/mutex.h> |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 17 | |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 18 | #include <asm/page.h> |
| 19 | #include <asm/pgtable.h> |
| 20 | |
| 21 | #include <linux/hugetlb.h> |
Nick Piggin | 7835e98 | 2006-03-22 00:08:40 -0800 | [diff] [blame] | 22 | #include "internal.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 23 | |
| 24 | const unsigned long hugetlb_zero = 0, hugetlb_infinity = ~0UL; |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 25 | static unsigned long nr_huge_pages, free_huge_pages, reserved_huge_pages; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | unsigned long max_huge_pages; |
| 27 | static struct list_head hugepage_freelists[MAX_NUMNODES]; |
| 28 | static unsigned int nr_huge_pages_node[MAX_NUMNODES]; |
| 29 | static unsigned int free_huge_pages_node[MAX_NUMNODES]; |
David Gibson | 3935baa | 2006-03-22 00:08:53 -0800 | [diff] [blame] | 30 | /* |
| 31 | * Protects updates to hugepage_freelists, nr_huge_pages, and free_huge_pages |
| 32 | */ |
| 33 | static DEFINE_SPINLOCK(hugetlb_lock); |
Eric Paris | 0bd0f9f | 2005-11-21 21:32:28 -0800 | [diff] [blame] | 34 | |
David Gibson | 79ac6ba | 2006-03-22 00:08:51 -0800 | [diff] [blame] | 35 | static void clear_huge_page(struct page *page, unsigned long addr) |
| 36 | { |
| 37 | int i; |
| 38 | |
| 39 | might_sleep(); |
| 40 | for (i = 0; i < (HPAGE_SIZE/PAGE_SIZE); i++) { |
| 41 | cond_resched(); |
| 42 | clear_user_highpage(page + i, addr); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | static void copy_huge_page(struct page *dst, struct page *src, |
| 47 | unsigned long addr) |
| 48 | { |
| 49 | int i; |
| 50 | |
| 51 | might_sleep(); |
| 52 | for (i = 0; i < HPAGE_SIZE/PAGE_SIZE; i++) { |
| 53 | cond_resched(); |
| 54 | copy_user_highpage(dst + i, src + i, addr + i*PAGE_SIZE); |
| 55 | } |
| 56 | } |
| 57 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | static void enqueue_huge_page(struct page *page) |
| 59 | { |
| 60 | int nid = page_to_nid(page); |
| 61 | list_add(&page->lru, &hugepage_freelists[nid]); |
| 62 | free_huge_pages++; |
| 63 | free_huge_pages_node[nid]++; |
| 64 | } |
| 65 | |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 66 | static struct page *dequeue_huge_page(struct vm_area_struct *vma, |
| 67 | unsigned long address) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 68 | { |
| 69 | int nid = numa_node_id(); |
| 70 | struct page *page = NULL; |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 71 | struct zonelist *zonelist = huge_zonelist(vma, address); |
Christoph Lameter | 96df933 | 2006-01-06 00:10:45 -0800 | [diff] [blame] | 72 | struct zone **z; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
Christoph Lameter | 96df933 | 2006-01-06 00:10:45 -0800 | [diff] [blame] | 74 | for (z = zonelist->zones; *z; z++) { |
| 75 | nid = (*z)->zone_pgdat->node_id; |
Christoph Lameter | aea47ff | 2006-01-08 01:00:57 -0800 | [diff] [blame] | 76 | if (cpuset_zone_allowed(*z, GFP_HIGHUSER) && |
| 77 | !list_empty(&hugepage_freelists[nid])) |
Christoph Lameter | 96df933 | 2006-01-06 00:10:45 -0800 | [diff] [blame] | 78 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | } |
Christoph Lameter | 96df933 | 2006-01-06 00:10:45 -0800 | [diff] [blame] | 80 | |
| 81 | if (*z) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | page = list_entry(hugepage_freelists[nid].next, |
| 83 | struct page, lru); |
| 84 | list_del(&page->lru); |
| 85 | free_huge_pages--; |
| 86 | free_huge_pages_node[nid]--; |
| 87 | } |
| 88 | return page; |
| 89 | } |
| 90 | |
David Gibson | 27a85ef | 2006-03-22 00:08:56 -0800 | [diff] [blame^] | 91 | static void free_huge_page(struct page *page) |
| 92 | { |
| 93 | BUG_ON(page_count(page)); |
| 94 | |
| 95 | INIT_LIST_HEAD(&page->lru); |
| 96 | |
| 97 | spin_lock(&hugetlb_lock); |
| 98 | enqueue_huge_page(page); |
| 99 | spin_unlock(&hugetlb_lock); |
| 100 | } |
| 101 | |
Nick Piggin | a482289 | 2006-03-22 00:08:08 -0800 | [diff] [blame] | 102 | static int alloc_fresh_huge_page(void) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 103 | { |
| 104 | static int nid = 0; |
| 105 | struct page *page; |
| 106 | page = alloc_pages_node(nid, GFP_HIGHUSER|__GFP_COMP|__GFP_NOWARN, |
| 107 | HUGETLB_PAGE_ORDER); |
| 108 | nid = (nid + 1) % num_online_nodes(); |
| 109 | if (page) { |
Nick Piggin | a482289 | 2006-03-22 00:08:08 -0800 | [diff] [blame] | 110 | page[1].lru.next = (void *)free_huge_page; /* dtor */ |
Eric Paris | 0bd0f9f | 2005-11-21 21:32:28 -0800 | [diff] [blame] | 111 | spin_lock(&hugetlb_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 112 | nr_huge_pages++; |
| 113 | nr_huge_pages_node[page_to_nid(page)]++; |
Eric Paris | 0bd0f9f | 2005-11-21 21:32:28 -0800 | [diff] [blame] | 114 | spin_unlock(&hugetlb_lock); |
Nick Piggin | a482289 | 2006-03-22 00:08:08 -0800 | [diff] [blame] | 115 | put_page(page); /* free it into the hugepage allocator */ |
| 116 | return 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | } |
Nick Piggin | a482289 | 2006-03-22 00:08:08 -0800 | [diff] [blame] | 118 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 119 | } |
| 120 | |
David Gibson | 27a85ef | 2006-03-22 00:08:56 -0800 | [diff] [blame^] | 121 | static struct page *alloc_huge_page(struct vm_area_struct *vma, |
| 122 | unsigned long addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 123 | { |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 124 | struct inode *inode = vma->vm_file->f_dentry->d_inode; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 125 | struct page *page; |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 126 | int use_reserve = 0; |
| 127 | unsigned long idx; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 128 | |
| 129 | spin_lock(&hugetlb_lock); |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 130 | |
| 131 | if (vma->vm_flags & VM_MAYSHARE) { |
| 132 | |
| 133 | /* idx = radix tree index, i.e. offset into file in |
| 134 | * HPAGE_SIZE units */ |
| 135 | idx = ((addr - vma->vm_start) >> HPAGE_SHIFT) |
| 136 | + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT)); |
| 137 | |
| 138 | /* The hugetlbfs specific inode info stores the number |
| 139 | * of "guaranteed available" (huge) pages. That is, |
| 140 | * the first 'prereserved_hpages' pages of the inode |
| 141 | * are either already instantiated, or have been |
| 142 | * pre-reserved (by hugetlb_reserve_for_inode()). Here |
| 143 | * we're in the process of instantiating the page, so |
| 144 | * we use this to determine whether to draw from the |
| 145 | * pre-reserved pool or the truly free pool. */ |
| 146 | if (idx < HUGETLBFS_I(inode)->prereserved_hpages) |
| 147 | use_reserve = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 148 | } |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 149 | |
| 150 | if (!use_reserve) { |
| 151 | if (free_huge_pages <= reserved_huge_pages) |
| 152 | goto fail; |
| 153 | } else { |
| 154 | BUG_ON(reserved_huge_pages == 0); |
| 155 | reserved_huge_pages--; |
| 156 | } |
| 157 | |
| 158 | page = dequeue_huge_page(vma, addr); |
| 159 | if (!page) |
| 160 | goto fail; |
| 161 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 162 | spin_unlock(&hugetlb_lock); |
Nick Piggin | 7835e98 | 2006-03-22 00:08:40 -0800 | [diff] [blame] | 163 | set_page_refcounted(page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 164 | return page; |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 165 | |
| 166 | fail: |
| 167 | WARN_ON(use_reserve); /* reserved allocations shouldn't fail */ |
| 168 | spin_unlock(&hugetlb_lock); |
| 169 | return NULL; |
| 170 | } |
| 171 | |
| 172 | /* hugetlb_extend_reservation() |
| 173 | * |
| 174 | * Ensure that at least 'atleast' hugepages are, and will remain, |
| 175 | * available to instantiate the first 'atleast' pages of the given |
| 176 | * inode. If the inode doesn't already have this many pages reserved |
| 177 | * or instantiated, set aside some hugepages in the reserved pool to |
| 178 | * satisfy later faults (or fail now if there aren't enough, rather |
| 179 | * than getting the SIGBUS later). |
| 180 | */ |
| 181 | int hugetlb_extend_reservation(struct hugetlbfs_inode_info *info, |
| 182 | unsigned long atleast) |
| 183 | { |
| 184 | struct inode *inode = &info->vfs_inode; |
| 185 | unsigned long change_in_reserve = 0; |
| 186 | int ret = 0; |
| 187 | |
| 188 | spin_lock(&hugetlb_lock); |
| 189 | read_lock_irq(&inode->i_mapping->tree_lock); |
| 190 | |
| 191 | if (info->prereserved_hpages >= atleast) |
| 192 | goto out; |
| 193 | |
| 194 | /* Because we always call this on shared mappings, none of the |
| 195 | * pages beyond info->prereserved_hpages can have been |
| 196 | * instantiated, so we need to reserve all of them now. */ |
| 197 | change_in_reserve = atleast - info->prereserved_hpages; |
| 198 | |
| 199 | if ((reserved_huge_pages + change_in_reserve) > free_huge_pages) { |
| 200 | ret = -ENOMEM; |
| 201 | goto out; |
| 202 | } |
| 203 | |
| 204 | reserved_huge_pages += change_in_reserve; |
| 205 | info->prereserved_hpages = atleast; |
| 206 | |
| 207 | out: |
| 208 | read_unlock_irq(&inode->i_mapping->tree_lock); |
| 209 | spin_unlock(&hugetlb_lock); |
| 210 | |
| 211 | return ret; |
| 212 | } |
| 213 | |
| 214 | /* hugetlb_truncate_reservation() |
| 215 | * |
| 216 | * This returns pages reserved for the given inode to the general free |
| 217 | * hugepage pool. If the inode has any pages prereserved, but not |
| 218 | * instantiated, beyond offset (atmost << HPAGE_SIZE), then release |
| 219 | * them. |
| 220 | */ |
| 221 | void hugetlb_truncate_reservation(struct hugetlbfs_inode_info *info, |
| 222 | unsigned long atmost) |
| 223 | { |
| 224 | struct inode *inode = &info->vfs_inode; |
| 225 | struct address_space *mapping = inode->i_mapping; |
| 226 | unsigned long idx; |
| 227 | unsigned long change_in_reserve = 0; |
| 228 | struct page *page; |
| 229 | |
| 230 | spin_lock(&hugetlb_lock); |
| 231 | read_lock_irq(&inode->i_mapping->tree_lock); |
| 232 | |
| 233 | if (info->prereserved_hpages <= atmost) |
| 234 | goto out; |
| 235 | |
| 236 | /* Count pages which were reserved, but not instantiated, and |
| 237 | * which we can now release. */ |
| 238 | for (idx = atmost; idx < info->prereserved_hpages; idx++) { |
| 239 | page = radix_tree_lookup(&mapping->page_tree, idx); |
| 240 | if (!page) |
| 241 | /* Pages which are already instantiated can't |
| 242 | * be unreserved (and in fact have already |
| 243 | * been removed from the reserved pool) */ |
| 244 | change_in_reserve++; |
| 245 | } |
| 246 | |
| 247 | BUG_ON(reserved_huge_pages < change_in_reserve); |
| 248 | reserved_huge_pages -= change_in_reserve; |
| 249 | info->prereserved_hpages = atmost; |
| 250 | |
| 251 | out: |
| 252 | read_unlock_irq(&inode->i_mapping->tree_lock); |
| 253 | spin_unlock(&hugetlb_lock); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 254 | } |
| 255 | |
| 256 | static int __init hugetlb_init(void) |
| 257 | { |
| 258 | unsigned long i; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 259 | |
Benjamin Herrenschmidt | 3c726f8 | 2005-11-07 11:06:55 +1100 | [diff] [blame] | 260 | if (HPAGE_SHIFT == 0) |
| 261 | return 0; |
| 262 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | for (i = 0; i < MAX_NUMNODES; ++i) |
| 264 | INIT_LIST_HEAD(&hugepage_freelists[i]); |
| 265 | |
| 266 | for (i = 0; i < max_huge_pages; ++i) { |
Nick Piggin | a482289 | 2006-03-22 00:08:08 -0800 | [diff] [blame] | 267 | if (!alloc_fresh_huge_page()) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 268 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 269 | } |
| 270 | max_huge_pages = free_huge_pages = nr_huge_pages = i; |
| 271 | printk("Total HugeTLB memory allocated, %ld\n", free_huge_pages); |
| 272 | return 0; |
| 273 | } |
| 274 | module_init(hugetlb_init); |
| 275 | |
| 276 | static int __init hugetlb_setup(char *s) |
| 277 | { |
| 278 | if (sscanf(s, "%lu", &max_huge_pages) <= 0) |
| 279 | max_huge_pages = 0; |
| 280 | return 1; |
| 281 | } |
| 282 | __setup("hugepages=", hugetlb_setup); |
| 283 | |
| 284 | #ifdef CONFIG_SYSCTL |
| 285 | static void update_and_free_page(struct page *page) |
| 286 | { |
| 287 | int i; |
| 288 | nr_huge_pages--; |
| 289 | nr_huge_pages_node[page_zone(page)->zone_pgdat->node_id]--; |
| 290 | for (i = 0; i < (HPAGE_SIZE / PAGE_SIZE); i++) { |
| 291 | page[i].flags &= ~(1 << PG_locked | 1 << PG_error | 1 << PG_referenced | |
| 292 | 1 << PG_dirty | 1 << PG_active | 1 << PG_reserved | |
| 293 | 1 << PG_private | 1<< PG_writeback); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 294 | } |
Nick Piggin | a482289 | 2006-03-22 00:08:08 -0800 | [diff] [blame] | 295 | page[1].lru.next = NULL; |
Nick Piggin | 7835e98 | 2006-03-22 00:08:40 -0800 | [diff] [blame] | 296 | set_page_refcounted(page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 297 | __free_pages(page, HUGETLB_PAGE_ORDER); |
| 298 | } |
| 299 | |
| 300 | #ifdef CONFIG_HIGHMEM |
| 301 | static void try_to_free_low(unsigned long count) |
| 302 | { |
| 303 | int i, nid; |
| 304 | for (i = 0; i < MAX_NUMNODES; ++i) { |
| 305 | struct page *page, *next; |
| 306 | list_for_each_entry_safe(page, next, &hugepage_freelists[i], lru) { |
| 307 | if (PageHighMem(page)) |
| 308 | continue; |
| 309 | list_del(&page->lru); |
| 310 | update_and_free_page(page); |
| 311 | nid = page_zone(page)->zone_pgdat->node_id; |
| 312 | free_huge_pages--; |
| 313 | free_huge_pages_node[nid]--; |
| 314 | if (count >= nr_huge_pages) |
| 315 | return; |
| 316 | } |
| 317 | } |
| 318 | } |
| 319 | #else |
| 320 | static inline void try_to_free_low(unsigned long count) |
| 321 | { |
| 322 | } |
| 323 | #endif |
| 324 | |
| 325 | static unsigned long set_max_huge_pages(unsigned long count) |
| 326 | { |
| 327 | while (count > nr_huge_pages) { |
Nick Piggin | a482289 | 2006-03-22 00:08:08 -0800 | [diff] [blame] | 328 | if (!alloc_fresh_huge_page()) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 329 | return nr_huge_pages; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 330 | } |
| 331 | if (count >= nr_huge_pages) |
| 332 | return nr_huge_pages; |
| 333 | |
| 334 | spin_lock(&hugetlb_lock); |
| 335 | try_to_free_low(count); |
| 336 | while (count < nr_huge_pages) { |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 337 | struct page *page = dequeue_huge_page(NULL, 0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 338 | if (!page) |
| 339 | break; |
| 340 | update_and_free_page(page); |
| 341 | } |
| 342 | spin_unlock(&hugetlb_lock); |
| 343 | return nr_huge_pages; |
| 344 | } |
| 345 | |
| 346 | int hugetlb_sysctl_handler(struct ctl_table *table, int write, |
| 347 | struct file *file, void __user *buffer, |
| 348 | size_t *length, loff_t *ppos) |
| 349 | { |
| 350 | proc_doulongvec_minmax(table, write, file, buffer, length, ppos); |
| 351 | max_huge_pages = set_max_huge_pages(max_huge_pages); |
| 352 | return 0; |
| 353 | } |
| 354 | #endif /* CONFIG_SYSCTL */ |
| 355 | |
| 356 | int hugetlb_report_meminfo(char *buf) |
| 357 | { |
| 358 | return sprintf(buf, |
| 359 | "HugePages_Total: %5lu\n" |
| 360 | "HugePages_Free: %5lu\n" |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 361 | "HugePages_Rsvd: %5lu\n" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | "Hugepagesize: %5lu kB\n", |
| 363 | nr_huge_pages, |
| 364 | free_huge_pages, |
David Gibson | b45b5bd | 2006-03-22 00:08:55 -0800 | [diff] [blame] | 365 | reserved_huge_pages, |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 366 | HPAGE_SIZE/1024); |
| 367 | } |
| 368 | |
| 369 | int hugetlb_report_node_meminfo(int nid, char *buf) |
| 370 | { |
| 371 | return sprintf(buf, |
| 372 | "Node %d HugePages_Total: %5u\n" |
| 373 | "Node %d HugePages_Free: %5u\n", |
| 374 | nid, nr_huge_pages_node[nid], |
| 375 | nid, free_huge_pages_node[nid]); |
| 376 | } |
| 377 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 378 | /* Return the number pages of memory we physically have, in PAGE_SIZE units. */ |
| 379 | unsigned long hugetlb_total_pages(void) |
| 380 | { |
| 381 | return nr_huge_pages * (HPAGE_SIZE / PAGE_SIZE); |
| 382 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 383 | |
| 384 | /* |
| 385 | * We cannot handle pagefaults against hugetlb pages at all. They cause |
| 386 | * handle_mm_fault() to try to instantiate regular-sized pages in the |
| 387 | * hugegpage VMA. do_page_fault() is supposed to trap this, so BUG is we get |
| 388 | * this far. |
| 389 | */ |
| 390 | static struct page *hugetlb_nopage(struct vm_area_struct *vma, |
| 391 | unsigned long address, int *unused) |
| 392 | { |
| 393 | BUG(); |
| 394 | return NULL; |
| 395 | } |
| 396 | |
| 397 | struct vm_operations_struct hugetlb_vm_ops = { |
| 398 | .nopage = hugetlb_nopage, |
| 399 | }; |
| 400 | |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 401 | static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page, |
| 402 | int writable) |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 403 | { |
| 404 | pte_t entry; |
| 405 | |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 406 | if (writable) { |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 407 | entry = |
| 408 | pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot))); |
| 409 | } else { |
| 410 | entry = pte_wrprotect(mk_pte(page, vma->vm_page_prot)); |
| 411 | } |
| 412 | entry = pte_mkyoung(entry); |
| 413 | entry = pte_mkhuge(entry); |
| 414 | |
| 415 | return entry; |
| 416 | } |
| 417 | |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 418 | static void set_huge_ptep_writable(struct vm_area_struct *vma, |
| 419 | unsigned long address, pte_t *ptep) |
| 420 | { |
| 421 | pte_t entry; |
| 422 | |
| 423 | entry = pte_mkwrite(pte_mkdirty(*ptep)); |
| 424 | ptep_set_access_flags(vma, address, ptep, entry, 1); |
| 425 | update_mmu_cache(vma, address, entry); |
| 426 | lazy_mmu_prot_update(entry); |
| 427 | } |
| 428 | |
| 429 | |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 430 | int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, |
| 431 | struct vm_area_struct *vma) |
| 432 | { |
| 433 | pte_t *src_pte, *dst_pte, entry; |
| 434 | struct page *ptepage; |
Hugh Dickins | 1c59827 | 2005-10-19 21:23:43 -0700 | [diff] [blame] | 435 | unsigned long addr; |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 436 | int cow; |
| 437 | |
| 438 | cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE; |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 439 | |
Hugh Dickins | 1c59827 | 2005-10-19 21:23:43 -0700 | [diff] [blame] | 440 | for (addr = vma->vm_start; addr < vma->vm_end; addr += HPAGE_SIZE) { |
Hugh Dickins | c74df32 | 2005-10-29 18:16:23 -0700 | [diff] [blame] | 441 | src_pte = huge_pte_offset(src, addr); |
| 442 | if (!src_pte) |
| 443 | continue; |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 444 | dst_pte = huge_pte_alloc(dst, addr); |
| 445 | if (!dst_pte) |
| 446 | goto nomem; |
Hugh Dickins | c74df32 | 2005-10-29 18:16:23 -0700 | [diff] [blame] | 447 | spin_lock(&dst->page_table_lock); |
Hugh Dickins | 1c59827 | 2005-10-19 21:23:43 -0700 | [diff] [blame] | 448 | spin_lock(&src->page_table_lock); |
Hugh Dickins | c74df32 | 2005-10-29 18:16:23 -0700 | [diff] [blame] | 449 | if (!pte_none(*src_pte)) { |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 450 | if (cow) |
| 451 | ptep_set_wrprotect(src, addr, src_pte); |
Hugh Dickins | 1c59827 | 2005-10-19 21:23:43 -0700 | [diff] [blame] | 452 | entry = *src_pte; |
| 453 | ptepage = pte_page(entry); |
| 454 | get_page(ptepage); |
Hugh Dickins | 4294621 | 2005-10-29 18:16:05 -0700 | [diff] [blame] | 455 | add_mm_counter(dst, file_rss, HPAGE_SIZE / PAGE_SIZE); |
Hugh Dickins | 1c59827 | 2005-10-19 21:23:43 -0700 | [diff] [blame] | 456 | set_huge_pte_at(dst, addr, dst_pte, entry); |
| 457 | } |
| 458 | spin_unlock(&src->page_table_lock); |
Hugh Dickins | c74df32 | 2005-10-29 18:16:23 -0700 | [diff] [blame] | 459 | spin_unlock(&dst->page_table_lock); |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 460 | } |
| 461 | return 0; |
| 462 | |
| 463 | nomem: |
| 464 | return -ENOMEM; |
| 465 | } |
| 466 | |
| 467 | void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, |
| 468 | unsigned long end) |
| 469 | { |
| 470 | struct mm_struct *mm = vma->vm_mm; |
| 471 | unsigned long address; |
David Gibson | c7546f8 | 2005-08-05 11:59:35 -0700 | [diff] [blame] | 472 | pte_t *ptep; |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 473 | pte_t pte; |
| 474 | struct page *page; |
| 475 | |
| 476 | WARN_ON(!is_vm_hugetlb_page(vma)); |
| 477 | BUG_ON(start & ~HPAGE_MASK); |
| 478 | BUG_ON(end & ~HPAGE_MASK); |
| 479 | |
Hugh Dickins | 508034a | 2005-10-29 18:16:30 -0700 | [diff] [blame] | 480 | spin_lock(&mm->page_table_lock); |
| 481 | |
Hugh Dickins | 365e9c87 | 2005-10-29 18:16:18 -0700 | [diff] [blame] | 482 | /* Update high watermark before we lower rss */ |
| 483 | update_hiwater_rss(mm); |
| 484 | |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 485 | for (address = start; address < end; address += HPAGE_SIZE) { |
David Gibson | c7546f8 | 2005-08-05 11:59:35 -0700 | [diff] [blame] | 486 | ptep = huge_pte_offset(mm, address); |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 487 | if (!ptep) |
David Gibson | c7546f8 | 2005-08-05 11:59:35 -0700 | [diff] [blame] | 488 | continue; |
| 489 | |
| 490 | pte = huge_ptep_get_and_clear(mm, address, ptep); |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 491 | if (pte_none(pte)) |
| 492 | continue; |
David Gibson | c7546f8 | 2005-08-05 11:59:35 -0700 | [diff] [blame] | 493 | |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 494 | page = pte_page(pte); |
| 495 | put_page(page); |
Hugh Dickins | 4294621 | 2005-10-29 18:16:05 -0700 | [diff] [blame] | 496 | add_mm_counter(mm, file_rss, (int) -(HPAGE_SIZE / PAGE_SIZE)); |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 497 | } |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 498 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 499 | spin_unlock(&mm->page_table_lock); |
Hugh Dickins | 508034a | 2005-10-29 18:16:30 -0700 | [diff] [blame] | 500 | flush_tlb_range(vma, start, end); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 501 | } |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 502 | |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 503 | static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma, |
| 504 | unsigned long address, pte_t *ptep, pte_t pte) |
| 505 | { |
| 506 | struct page *old_page, *new_page; |
David Gibson | 79ac6ba | 2006-03-22 00:08:51 -0800 | [diff] [blame] | 507 | int avoidcopy; |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 508 | |
| 509 | old_page = pte_page(pte); |
| 510 | |
| 511 | /* If no-one else is actually using this page, avoid the copy |
| 512 | * and just make the page writable */ |
| 513 | avoidcopy = (page_count(old_page) == 1); |
| 514 | if (avoidcopy) { |
| 515 | set_huge_ptep_writable(vma, address, ptep); |
| 516 | return VM_FAULT_MINOR; |
| 517 | } |
| 518 | |
| 519 | page_cache_get(old_page); |
Christoph Lameter | 5da7ca8 | 2006-01-06 00:10:46 -0800 | [diff] [blame] | 520 | new_page = alloc_huge_page(vma, address); |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 521 | |
| 522 | if (!new_page) { |
| 523 | page_cache_release(old_page); |
Christoph Lameter | 0df420d | 2006-02-07 12:58:30 -0800 | [diff] [blame] | 524 | return VM_FAULT_OOM; |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 525 | } |
| 526 | |
| 527 | spin_unlock(&mm->page_table_lock); |
David Gibson | 79ac6ba | 2006-03-22 00:08:51 -0800 | [diff] [blame] | 528 | copy_huge_page(new_page, old_page, address); |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 529 | spin_lock(&mm->page_table_lock); |
| 530 | |
| 531 | ptep = huge_pte_offset(mm, address & HPAGE_MASK); |
| 532 | if (likely(pte_same(*ptep, pte))) { |
| 533 | /* Break COW */ |
| 534 | set_huge_pte_at(mm, address, ptep, |
| 535 | make_huge_pte(vma, new_page, 1)); |
| 536 | /* Make the old page be freed below */ |
| 537 | new_page = old_page; |
| 538 | } |
| 539 | page_cache_release(new_page); |
| 540 | page_cache_release(old_page); |
| 541 | return VM_FAULT_MINOR; |
| 542 | } |
| 543 | |
Adam Litke | 86e5216 | 2006-01-06 00:10:43 -0800 | [diff] [blame] | 544 | int hugetlb_no_page(struct mm_struct *mm, struct vm_area_struct *vma, |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 545 | unsigned long address, pte_t *ptep, int write_access) |
Hugh Dickins | ac9b9c6 | 2005-10-20 16:24:28 +0100 | [diff] [blame] | 546 | { |
| 547 | int ret = VM_FAULT_SIGBUS; |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 548 | unsigned long idx; |
| 549 | unsigned long size; |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 550 | struct page *page; |
| 551 | struct address_space *mapping; |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 552 | pte_t new_pte; |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 553 | |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 554 | mapping = vma->vm_file->f_mapping; |
| 555 | idx = ((address - vma->vm_start) >> HPAGE_SHIFT) |
| 556 | + (vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT)); |
| 557 | |
| 558 | /* |
| 559 | * Use page lock to guard against racing truncation |
| 560 | * before we get page_table_lock. |
| 561 | */ |
Christoph Lameter | 6bda666 | 2006-01-06 00:10:49 -0800 | [diff] [blame] | 562 | retry: |
| 563 | page = find_lock_page(mapping, idx); |
| 564 | if (!page) { |
| 565 | if (hugetlb_get_quota(mapping)) |
| 566 | goto out; |
| 567 | page = alloc_huge_page(vma, address); |
| 568 | if (!page) { |
| 569 | hugetlb_put_quota(mapping); |
Christoph Lameter | 0df420d | 2006-02-07 12:58:30 -0800 | [diff] [blame] | 570 | ret = VM_FAULT_OOM; |
Christoph Lameter | 6bda666 | 2006-01-06 00:10:49 -0800 | [diff] [blame] | 571 | goto out; |
| 572 | } |
David Gibson | 79ac6ba | 2006-03-22 00:08:51 -0800 | [diff] [blame] | 573 | clear_huge_page(page, address); |
Hugh Dickins | ac9b9c6 | 2005-10-20 16:24:28 +0100 | [diff] [blame] | 574 | |
Christoph Lameter | 6bda666 | 2006-01-06 00:10:49 -0800 | [diff] [blame] | 575 | if (vma->vm_flags & VM_SHARED) { |
| 576 | int err; |
| 577 | |
| 578 | err = add_to_page_cache(page, mapping, idx, GFP_KERNEL); |
| 579 | if (err) { |
| 580 | put_page(page); |
| 581 | hugetlb_put_quota(mapping); |
| 582 | if (err == -EEXIST) |
| 583 | goto retry; |
| 584 | goto out; |
| 585 | } |
| 586 | } else |
| 587 | lock_page(page); |
| 588 | } |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 589 | |
Hugh Dickins | ac9b9c6 | 2005-10-20 16:24:28 +0100 | [diff] [blame] | 590 | spin_lock(&mm->page_table_lock); |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 591 | size = i_size_read(mapping->host) >> HPAGE_SHIFT; |
| 592 | if (idx >= size) |
| 593 | goto backout; |
| 594 | |
| 595 | ret = VM_FAULT_MINOR; |
Adam Litke | 86e5216 | 2006-01-06 00:10:43 -0800 | [diff] [blame] | 596 | if (!pte_none(*ptep)) |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 597 | goto backout; |
| 598 | |
| 599 | add_mm_counter(mm, file_rss, HPAGE_SIZE / PAGE_SIZE); |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 600 | new_pte = make_huge_pte(vma, page, ((vma->vm_flags & VM_WRITE) |
| 601 | && (vma->vm_flags & VM_SHARED))); |
| 602 | set_huge_pte_at(mm, address, ptep, new_pte); |
| 603 | |
| 604 | if (write_access && !(vma->vm_flags & VM_SHARED)) { |
| 605 | /* Optimization, do the COW without a second fault */ |
| 606 | ret = hugetlb_cow(mm, vma, address, ptep, new_pte); |
| 607 | } |
| 608 | |
Hugh Dickins | ac9b9c6 | 2005-10-20 16:24:28 +0100 | [diff] [blame] | 609 | spin_unlock(&mm->page_table_lock); |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 610 | unlock_page(page); |
| 611 | out: |
Hugh Dickins | ac9b9c6 | 2005-10-20 16:24:28 +0100 | [diff] [blame] | 612 | return ret; |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 613 | |
| 614 | backout: |
| 615 | spin_unlock(&mm->page_table_lock); |
| 616 | hugetlb_put_quota(mapping); |
| 617 | unlock_page(page); |
| 618 | put_page(page); |
| 619 | goto out; |
Hugh Dickins | ac9b9c6 | 2005-10-20 16:24:28 +0100 | [diff] [blame] | 620 | } |
| 621 | |
Adam Litke | 86e5216 | 2006-01-06 00:10:43 -0800 | [diff] [blame] | 622 | int hugetlb_fault(struct mm_struct *mm, struct vm_area_struct *vma, |
| 623 | unsigned long address, int write_access) |
| 624 | { |
| 625 | pte_t *ptep; |
| 626 | pte_t entry; |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 627 | int ret; |
David Gibson | 3935baa | 2006-03-22 00:08:53 -0800 | [diff] [blame] | 628 | static DEFINE_MUTEX(hugetlb_instantiation_mutex); |
Adam Litke | 86e5216 | 2006-01-06 00:10:43 -0800 | [diff] [blame] | 629 | |
| 630 | ptep = huge_pte_alloc(mm, address); |
| 631 | if (!ptep) |
| 632 | return VM_FAULT_OOM; |
| 633 | |
David Gibson | 3935baa | 2006-03-22 00:08:53 -0800 | [diff] [blame] | 634 | /* |
| 635 | * Serialize hugepage allocation and instantiation, so that we don't |
| 636 | * get spurious allocation failures if two CPUs race to instantiate |
| 637 | * the same page in the page cache. |
| 638 | */ |
| 639 | mutex_lock(&hugetlb_instantiation_mutex); |
Adam Litke | 86e5216 | 2006-01-06 00:10:43 -0800 | [diff] [blame] | 640 | entry = *ptep; |
David Gibson | 3935baa | 2006-03-22 00:08:53 -0800 | [diff] [blame] | 641 | if (pte_none(entry)) { |
| 642 | ret = hugetlb_no_page(mm, vma, address, ptep, write_access); |
| 643 | mutex_unlock(&hugetlb_instantiation_mutex); |
| 644 | return ret; |
| 645 | } |
Adam Litke | 86e5216 | 2006-01-06 00:10:43 -0800 | [diff] [blame] | 646 | |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 647 | ret = VM_FAULT_MINOR; |
| 648 | |
| 649 | spin_lock(&mm->page_table_lock); |
| 650 | /* Check for a racing update before calling hugetlb_cow */ |
| 651 | if (likely(pte_same(entry, *ptep))) |
| 652 | if (write_access && !pte_write(entry)) |
| 653 | ret = hugetlb_cow(mm, vma, address, ptep, entry); |
| 654 | spin_unlock(&mm->page_table_lock); |
David Gibson | 3935baa | 2006-03-22 00:08:53 -0800 | [diff] [blame] | 655 | mutex_unlock(&hugetlb_instantiation_mutex); |
David Gibson | 1e8f889 | 2006-01-06 00:10:44 -0800 | [diff] [blame] | 656 | |
| 657 | return ret; |
Adam Litke | 86e5216 | 2006-01-06 00:10:43 -0800 | [diff] [blame] | 658 | } |
| 659 | |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 660 | int follow_hugetlb_page(struct mm_struct *mm, struct vm_area_struct *vma, |
| 661 | struct page **pages, struct vm_area_struct **vmas, |
| 662 | unsigned long *position, int *length, int i) |
| 663 | { |
| 664 | unsigned long vpfn, vaddr = *position; |
| 665 | int remainder = *length; |
| 666 | |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 667 | vpfn = vaddr/PAGE_SIZE; |
Hugh Dickins | 1c59827 | 2005-10-19 21:23:43 -0700 | [diff] [blame] | 668 | spin_lock(&mm->page_table_lock); |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 669 | while (vaddr < vma->vm_end && remainder) { |
Adam Litke | 4c88726 | 2005-10-29 18:16:46 -0700 | [diff] [blame] | 670 | pte_t *pte; |
| 671 | struct page *page; |
| 672 | |
| 673 | /* |
| 674 | * Some archs (sparc64, sh*) have multiple pte_ts to |
| 675 | * each hugepage. We have to make * sure we get the |
| 676 | * first, for the page indexing below to work. |
| 677 | */ |
| 678 | pte = huge_pte_offset(mm, vaddr & HPAGE_MASK); |
| 679 | |
| 680 | if (!pte || pte_none(*pte)) { |
| 681 | int ret; |
| 682 | |
| 683 | spin_unlock(&mm->page_table_lock); |
| 684 | ret = hugetlb_fault(mm, vma, vaddr, 0); |
| 685 | spin_lock(&mm->page_table_lock); |
| 686 | if (ret == VM_FAULT_MINOR) |
| 687 | continue; |
| 688 | |
| 689 | remainder = 0; |
| 690 | if (!i) |
| 691 | i = -EFAULT; |
| 692 | break; |
| 693 | } |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 694 | |
| 695 | if (pages) { |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 696 | page = &pte_page(*pte)[vpfn % (HPAGE_SIZE/PAGE_SIZE)]; |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 697 | get_page(page); |
| 698 | pages[i] = page; |
| 699 | } |
| 700 | |
| 701 | if (vmas) |
| 702 | vmas[i] = vma; |
| 703 | |
| 704 | vaddr += PAGE_SIZE; |
| 705 | ++vpfn; |
| 706 | --remainder; |
| 707 | ++i; |
| 708 | } |
Hugh Dickins | 1c59827 | 2005-10-19 21:23:43 -0700 | [diff] [blame] | 709 | spin_unlock(&mm->page_table_lock); |
David Gibson | 63551ae | 2005-06-21 17:14:44 -0700 | [diff] [blame] | 710 | *length = remainder; |
| 711 | *position = vaddr; |
| 712 | |
| 713 | return i; |
| 714 | } |
Zhang, Yanmin | 8f86059 | 2006-03-22 00:08:50 -0800 | [diff] [blame] | 715 | |
| 716 | void hugetlb_change_protection(struct vm_area_struct *vma, |
| 717 | unsigned long address, unsigned long end, pgprot_t newprot) |
| 718 | { |
| 719 | struct mm_struct *mm = vma->vm_mm; |
| 720 | unsigned long start = address; |
| 721 | pte_t *ptep; |
| 722 | pte_t pte; |
| 723 | |
| 724 | BUG_ON(address >= end); |
| 725 | flush_cache_range(vma, address, end); |
| 726 | |
| 727 | spin_lock(&mm->page_table_lock); |
| 728 | for (; address < end; address += HPAGE_SIZE) { |
| 729 | ptep = huge_pte_offset(mm, address); |
| 730 | if (!ptep) |
| 731 | continue; |
| 732 | if (!pte_none(*ptep)) { |
| 733 | pte = huge_ptep_get_and_clear(mm, address, ptep); |
| 734 | pte = pte_mkhuge(pte_modify(pte, newprot)); |
| 735 | set_huge_pte_at(mm, address, ptep, pte); |
| 736 | lazy_mmu_prot_update(pte); |
| 737 | } |
| 738 | } |
| 739 | spin_unlock(&mm->page_table_lock); |
| 740 | |
| 741 | flush_tlb_range(vma, start, end); |
| 742 | } |
| 743 | |