diff options
author | KalimochoAz <calimochoazucarado@gmail.com> | 2012-07-27 01:24:03 +0200 |
---|---|---|
committer | KalimochoAz <calimochoazucarado@gmail.com> | 2012-07-27 01:24:03 +0200 |
commit | 3dfc3dfc7a13e46422f309fc03de421a765fb12c (patch) | |
tree | b018f6713bbfd63937a23b40708c3fb764e62222 /mm | |
parent | 042098f2e54409eda6b7324277aabd31aa359e28 (diff) | |
parent | ce05b1d31e57b7de6b814073e88bdd403ce71229 (diff) | |
download | kernel_samsung_crespo-3dfc3dfc7a13e46422f309fc03de421a765fb12c.zip kernel_samsung_crespo-3dfc3dfc7a13e46422f309fc03de421a765fb12c.tar.gz kernel_samsung_crespo-3dfc3dfc7a13e46422f309fc03de421a765fb12c.tar.bz2 |
Merge branch 'linux-3.0.y' into HEAD
Conflicts:
arch/arm/kernel/smp.c
Diffstat (limited to 'mm')
-rw-r--r-- | mm/compaction.c | 5 | ||||
-rw-r--r-- | mm/madvise.c | 16 | ||||
-rw-r--r-- | mm/vmscan.c | 7 |
3 files changed, 22 insertions, 6 deletions
diff --git a/mm/compaction.c b/mm/compaction.c index 1175c24..9cec4f2 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -611,8 +611,11 @@ static int compact_zone(struct zone *zone, struct compact_control *cc) if (err) { putback_lru_pages(&cc->migratepages); cc->nr_migratepages = 0; + if (err == -ENOMEM) { + ret = COMPACT_PARTIAL; + goto out; + } } - } out: diff --git a/mm/madvise.c b/mm/madvise.c index 2221491..deabe5f6 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -13,6 +13,7 @@ #include <linux/hugetlb.h> #include <linux/sched.h> #include <linux/ksm.h> +#include <linux/file.h> /* * Any behaviour which results in changes to the vma->vm_flags needs to @@ -197,14 +198,16 @@ static long madvise_remove(struct vm_area_struct *vma, struct address_space *mapping; loff_t offset, endoff; int error; + struct file *f; *prev = NULL; /* tell sys_madvise we drop mmap_sem */ if (vma->vm_flags & (VM_LOCKED|VM_NONLINEAR|VM_HUGETLB)) return -EINVAL; - if (!vma->vm_file || !vma->vm_file->f_mapping - || !vma->vm_file->f_mapping->host) { + f = vma->vm_file; + + if (!f || !f->f_mapping || !f->f_mapping->host) { return -EINVAL; } @@ -218,9 +221,16 @@ static long madvise_remove(struct vm_area_struct *vma, endoff = (loff_t)(end - vma->vm_start - 1) + ((loff_t)vma->vm_pgoff << PAGE_SHIFT); - /* vmtruncate_range needs to take i_mutex and i_alloc_sem */ + /* + * vmtruncate_range may need to take i_mutex and i_alloc_sem. + * We need to explicitly grab a reference because the vma (and + * hence the vma's reference to the file) can go away as soon as + * we drop mmap_sem. + */ + get_file(f); up_read(¤t->mm->mmap_sem); error = vmtruncate_range(mapping->host, offset, endoff); + fput(f); down_read(¤t->mm->mmap_sem); return error; } diff --git a/mm/vmscan.c b/mm/vmscan.c index 769935d..1b0ed36 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -2952,14 +2952,17 @@ int kswapd_run(int nid) } /* - * Called by memory hotplug when all memory in a node is offlined. + * Called by memory hotplug when all memory in a node is offlined. Caller must + * hold lock_memory_hotplug(). */ void kswapd_stop(int nid) { struct task_struct *kswapd = NODE_DATA(nid)->kswapd; - if (kswapd) + if (kswapd) { kthread_stop(kswapd); + NODE_DATA(nid)->kswapd = NULL; + } } static int __init kswapd_init(void) |