Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 29631
b: refs/heads/master
c: 7b2259b
h: refs/heads/master
i:
  29629: 105b5ca
  29627: 1b146fd
  29623: 97c9fc7
  29615: 966dbeb
  29599: 590a7d6
  29567: b0e3981
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Jun 25, 2006
1 parent 958ac1e commit 27b7e3a
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 68402ddc677005ed1b1359bbc1f279548cfc0928
refs/heads/master: 7b2259b3e53f128c10a9fded0965e69d4a949847
11 changes: 10 additions & 1 deletion trunk/include/linux/migrate.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ extern int fail_migrate_page(struct address_space *,
struct page *, struct page *);

extern int migrate_prep(void);

extern int migrate_vmas(struct mm_struct *mm,
const nodemask_t *from, const nodemask_t *to,
unsigned long flags);
#else

static inline int isolate_lru_page(struct page *p, struct list_head *list)
Expand All @@ -30,6 +32,13 @@ static inline int migrate_pages_to(struct list_head *pagelist,

static inline int migrate_prep(void) { return -ENOSYS; }

static inline int migrate_vmas(struct mm_struct *mm,
const nodemask_t *from, const nodemask_t *to,
unsigned long flags)
{
return -ENOSYS;
}

/* Possible settings for the migrate_page() method in address_operations */
#define migrate_page NULL
#define fail_migrate_page NULL
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ struct vm_operations_struct {
int (*set_policy)(struct vm_area_struct *vma, struct mempolicy *new);
struct mempolicy *(*get_policy)(struct vm_area_struct *vma,
unsigned long addr);
int (*migrate)(struct vm_area_struct *vma, const nodemask_t *from,
const nodemask_t *to, unsigned long flags);
#endif
};

Expand Down
6 changes: 5 additions & 1 deletion trunk/mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,10 @@ int do_migrate_pages(struct mm_struct *mm,

down_read(&mm->mmap_sem);

err = migrate_vmas(mm, from_nodes, to_nodes, flags);
if (err)
goto out;

/*
* Find a 'source' bit set in 'tmp' whose corresponding 'dest'
* bit in 'to' is not also set in 'tmp'. Clear the found 'source'
Expand Down Expand Up @@ -691,7 +695,7 @@ int do_migrate_pages(struct mm_struct *mm,
if (err < 0)
break;
}

out:
up_read(&mm->mmap_sem);
if (err < 0)
return err;
Expand Down
20 changes: 20 additions & 0 deletions trunk/mm/migrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -976,3 +976,23 @@ asmlinkage long sys_move_pages(pid_t pid, unsigned long nr_pages,
}
#endif

/*
* Call migration functions in the vma_ops that may prepare
* memory in a vm for migration. migration functions may perform
* the migration for vmas that do not have an underlying page struct.
*/
int migrate_vmas(struct mm_struct *mm, const nodemask_t *to,
const nodemask_t *from, unsigned long flags)
{
struct vm_area_struct *vma;
int err = 0;

for(vma = mm->mmap; vma->vm_next && !err; vma = vma->vm_next) {
if (vma->vm_ops && vma->vm_ops->migrate) {
err = vma->vm_ops->migrate(vma, to, from, flags);
if (err)
break;
}
}
return err;
}

0 comments on commit 27b7e3a

Please sign in to comment.