~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to mm/memory-failure.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
#include <linux/swapops.h>
53
53
#include <linux/hugetlb.h>
54
54
#include <linux/memory_hotplug.h>
 
55
#include <linux/mm_inline.h>
55
56
#include "internal.h"
56
57
 
57
58
int sysctl_memory_failure_early_kill __read_mostly = 0;
239
240
        if (access) {
240
241
                int nr;
241
242
                do {
242
 
                        nr = shrink_slab(1000, GFP_KERNEL, 1000);
 
243
                        struct shrink_control shrink = {
 
244
                                .gfp_mask = GFP_KERNEL,
 
245
                        };
 
246
 
 
247
                        nr = shrink_slab(&shrink, 1000, 1000);
243
248
                        if (page_count(p) == 1)
244
249
                                break;
245
250
                } while (nr > 10);
386
391
        struct task_struct *tsk;
387
392
        struct anon_vma *av;
388
393
 
389
 
        read_lock(&tasklist_lock);
390
394
        av = page_lock_anon_vma(page);
391
395
        if (av == NULL) /* Not actually mapped anymore */
392
 
                goto out;
 
396
                return;
 
397
 
 
398
        read_lock(&tasklist_lock);
393
399
        for_each_process (tsk) {
394
400
                struct anon_vma_chain *vmac;
395
401
 
403
409
                                add_to_kill(tsk, page, vma, to_kill, tkc);
404
410
                }
405
411
        }
 
412
        read_unlock(&tasklist_lock);
406
413
        page_unlock_anon_vma(av);
407
 
out:
408
 
        read_unlock(&tasklist_lock);
409
414
}
410
415
 
411
416
/*
419
424
        struct prio_tree_iter iter;
420
425
        struct address_space *mapping = page->mapping;
421
426
 
422
 
        /*
423
 
         * A note on the locking order between the two locks.
424
 
         * We don't rely on this particular order.
425
 
         * If you have some other code that needs a different order
426
 
         * feel free to switch them around. Or add a reverse link
427
 
         * from mm_struct to task_struct, then this could be all
428
 
         * done without taking tasklist_lock and looping over all tasks.
429
 
         */
430
 
 
 
427
        mutex_lock(&mapping->i_mmap_mutex);
431
428
        read_lock(&tasklist_lock);
432
 
        spin_lock(&mapping->i_mmap_lock);
433
429
        for_each_process(tsk) {
434
430
                pgoff_t pgoff = page->index << (PAGE_CACHE_SHIFT - PAGE_SHIFT);
435
431
 
449
445
                                add_to_kill(tsk, page, vma, to_kill, tkc);
450
446
                }
451
447
        }
452
 
        spin_unlock(&mapping->i_mmap_lock);
453
448
        read_unlock(&tasklist_lock);
 
449
        mutex_unlock(&mapping->i_mmap_mutex);
454
450
}
455
451
 
456
452
/*
1440
1436
         */
1441
1437
        ret = invalidate_inode_page(page);
1442
1438
        unlock_page(page);
1443
 
 
1444
1439
        /*
1445
 
         * Drop count because page migration doesn't like raised
1446
 
         * counts. The page could get re-allocated, but if it becomes
1447
 
         * LRU the isolation will just fail.
1448
1440
         * RED-PEN would be better to keep it isolated here, but we
1449
1441
         * would need to fix isolation locking first.
1450
1442
         */
1451
 
        put_page(page);
1452
1443
        if (ret == 1) {
 
1444
                put_page(page);
1453
1445
                ret = 0;
1454
1446
                pr_info("soft_offline: %#lx: invalidated\n", pfn);
1455
1447
                goto done;
1461
1453
         * handles a large number of cases for us.
1462
1454
         */
1463
1455
        ret = isolate_lru_page(page);
 
1456
        /*
 
1457
         * Drop page reference which is came from get_any_page()
 
1458
         * successful isolate_lru_page() already took another one.
 
1459
         */
 
1460
        put_page(page);
1464
1461
        if (!ret) {
1465
1462
                LIST_HEAD(pagelist);
1466
 
 
 
1463
                inc_zone_page_state(page, NR_ISOLATED_ANON +
 
1464
                                            page_is_file_cache(page));
1467
1465
                list_add(&page->lru, &pagelist);
1468
1466
                ret = migrate_pages(&pagelist, new_page, MPOL_MF_MOVE_ALL,
1469
1467
                                                                0, true);