linux-next: manual merge of the tip tree with Linus' tree

From: Stephen Rothwell
Date: Fri Jun 22 2012 - 01:02:49 EST


Hi all,

Today's linux-next merge of the tip tree got a conflict in mm/mempolicy.c
between commit c4c0e9e544a0 ("mm, mempolicy: fix mbind() to do
synchronous migration") from Linus' tree and various commits from the tip
tree.

The latter rewrote bits of this file, so I used it and effectively
reapplied the former patch (see below). I hope it came out right.

The diff of this file from the tip tree version looks like this (the
second hunk comes from the slab tree):

diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 2218157..aeb58da 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -1146,7 +1146,7 @@ long mpol_do_mbind(unsigned long start, unsigned long len,
else {
nr_failed = migrate_pages(&pagelist, new_vma_page,
(unsigned long)vma,
- false, true);
+ false, MIGRATE_SYNC);
}
}

@@ -1702,8 +1702,14 @@ static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy,
* task can change it's policy. The system default policy requires no
* such protection.
*/
-unsigned slab_node(struct mempolicy *policy)
+unsigned slab_node(void)
{
+ struct mempolicy *policy;
+
+ if (in_interrupt())
+ return numa_node_id();
+
+ policy = current->mempolicy;
if (!policy || policy->flags & MPOL_F_LOCAL)
return numa_node_id();


--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

diff --cc mm/mempolicy.c
index bd92431,2218157..0000000
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@@ -1097,6 -1085,81 +1085,81 @@@ static struct page *new_vma_page(struc
}
#endif

+ long mpol_do_mbind(unsigned long start, unsigned long len,
+ struct mempolicy *new, unsigned long mode,
+ nodemask_t *nmask, unsigned long flags)
+ {
+ struct mm_struct *mm = current->mm;
+ struct vm_area_struct *vma;
+ int err, nr_failed = 0;
+ unsigned long end;
+ LIST_HEAD(pagelist);
+
+ len = (len + PAGE_SIZE - 1) & PAGE_MASK;
+ end = start + len;
+
+ if (end < start) {
+ err = -EINVAL;
+ goto mpol_out;
+ }
+
+ if (end == start) {
+ err = 0;
+ goto mpol_out;
+ }
+
+ if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) {
+ err = migrate_prep();
+ if (err)
+ goto mpol_out;
+ }
+
+ if (mode != MPOL_NOOP) {
+ NODEMASK_SCRATCH(scratch);
+ err = -ENOMEM;
+ if (scratch) {
+ task_lock(current);
+ err = mpol_set_nodemask(new, nmask, scratch);
+ task_unlock(current);
+ }
+ NODEMASK_SCRATCH_FREE(scratch);
+ if (err)
+ goto mpol_out;
+ }
+
+ vma = check_range(mm, start, end, nmask,
+ flags | MPOL_MF_INVERT, &pagelist);
+
+ err = PTR_ERR(vma); /* maybe ... */
+ if (IS_ERR(vma))
+ goto mpol_out_putback;
+
+ if (mode != MPOL_NOOP) {
+ err = mbind_range(mm, start, end, new);
+ if (err)
+ goto mpol_out_putback;
+ }
+
+ if (!list_empty(&pagelist)) {
+ if (flags & MPOL_MF_LAZY)
+ nr_failed = migrate_pages_unmap_only(&pagelist);
+ else {
+ nr_failed = migrate_pages(&pagelist, new_vma_page,
+ (unsigned long)vma,
- false, true);
++ false, MIGRATE_SYNC);
+ }
+ }
+
+ if (nr_failed && (flags & MPOL_MF_STRICT))
+ err = -EIO;
+
+ mpol_out_putback:
+ putback_lru_pages(&pagelist);
+
+ mpol_out:
+ return err;
+ }
+
static long do_mbind(unsigned long start, unsigned long len,
unsigned short mode, unsigned short mode_flags,
nodemask_t *nmask, unsigned long flags)

Attachment: pgp00000.pgp
Description: PGP signature