AutoPage Migration - V0.1 - 1/8 migrate task memory with default policy
Subsystems (2)
AutoPage Migration - V0.1 - 1/8 migrate task memory with default policy
This patch introduces the mm/mempolicy.c "migrate_task_memory()" function. When called, this function will migrate all possible task pages with default policy that are not located on the node that contains the current task's cpu.
migrate_task_memory() operates on one vma at at time, filtering out those that don't have default policy and that have no access. Added helper function migrate_vma_to_node()--a slight variant of migrate_to_node()--that takes a vma instead of an mm struct. Changed comment on migrate_to_node() to indicate that it operates on entire mm.
I had to move get_vma_policy() up in mempolicy.c so that I could reference it from migrate_task_memory(). Should I have just added a forward ref declaration?
Subsequent patches will arrange for this function to be called when a task returns to user space after the scheduler migrates it to a cpu on a node different from the node where it last executed.
include/linux/mempolicy.h +4 -0
@@ -172,6 +172,8 @@ static inline void check_highest_zone(inint do_migrate_pages (struct mm_struct *mm,const nodemask_t *from_nodes,const nodemask_t *to_nodes,int flags); +extern void migrate_task_memory (void ); +extern void *cpuset_being_rebound;/* Trigger mpol_copy vma rebind */ #else
@@ -263,6 +265,8 @@ static inline int do_migrate_pages(strucreturn 0 ; } +static inline void migrate_task_memory (void ) { } +static inline void check_highest_zone (int k) { }
mm/mempolicy.c +110 -19
153 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
mm/mempolicy.c int do_migrate_pages(struct mm_struct *m · line 762
Quoted 7 lines · Lee Schermerhorn
mm/mempolicy.c +7
-0+/* +* Migrate all eligible pages mapped in vma NOT on destination node to +* the destination node. +* Returns error or the number of pages not migrated. +*/ +static int migrate_vma_to_node (struct vm_area_struct *vma,int dest,int flags) +{
This duplicates code in migrate_to_node().
mm/mempolicy.c int do_migrate_pages(struct mm_struct *m · line 786
Quoted 3 lines
mm/mempolicy.c +3
-0+/* +* for filtering 'no access' segments +TODO: what are these?
??
Quoted 8 lines
mm/mempolicy.c +8
-0+down_read (&mm->mmap_sem); +for (vma = mm->mmap; vma; vma = vma->vm_next) { +struct mempolicy *pol =get_vma_policy (current, vma, + vma->vm_start); +int err; + +if (pol->policy !=MPOL_DEFAULT ) +continue ;
mm/mempolicy.c int do_migrate_pages(struct mm_struct *m · line 841
Quoted 10 lines
mm/mempolicy.c +10
-0+if (vma_no_access (vma)) +continue ; + +// TODO: more eligibility filtering? + +// TODO: more agressive migration ['MOVE_ALL] ? +// via sysctl? + err =migrate_vma_to_node (vma, dest,MPOL_MF_MOVE ); + + }
Duplicates code in migrate_to_node().
Could you add some special casing instead to migrate_to_node and/or check_range?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 11 lines · Christoph Lameter
mm/mempolicy.c int do_migrate_pages(struct mm_struct *m · line 762
Quoted 7 lines · Lee Schermerhorn
mm/mempolicy.c +7
-0+/* +* Migrate all eligible pages mapped in vma NOT on destination node to +* the destination node. +* Returns error or the number of pages not migrated. +*/ +static int migrate_vma_to_node (struct vm_area_struct *vma,int dest,int flags) +{This duplicates code in
migrate_to_node().
Yes. At this point, this is intentional. I wanted to be able to see what I'm doing.
More below...
Quoted 19 lines
mm/mempolicy.c int do_migrate_pages(struct mm_struct *m · line 786
Quoted 4 lines
mm/mempolicy.c +3
-0+/* +* for filtering 'no access' segments +TODO: what are these? ??
Quoted 12 lines
mm/mempolicy.c +12
-0+down_read (&mm->mmap_sem); +for (vma = mm->mmap; vma; vma = vma->vm_next) { +struct mempolicy *pol =get_vma_policy (current, vma, + vma->vm_start); +int err; + +if (pol->policy !=MPOL_DEFAULT ) +continue ; +if (vma_no_access (vma)) +continue ; + +// TODO: more eligibility filtering?
Quoted 8 lines
mm/mempolicy.c int do_migrate_pages(struct mm_struct *m · line 841
Quoted 6 lines
mm/mempolicy.c +6
-0+ +// TODO: more agressive migration ['MOVE_ALL] ? +// via sysctl? + err =migrate_vma_to_node (vma, dest,MPOL_MF_MOVE ); + + }Duplicates code in
migrate_to_node().
Again, yes...
Quoted 3 lines
Could you add some special casing instead to
migrate_to_nodeand/orcheck_range?
I think this could be done. Don't know whether the results would be "pretty" or not.
Currently, you'll note that I'm calling check_range for one vma at a time. I'm not sure this is a good idea. It probably adds overhead revisiting upper level page table pages many times. But, I want to compare different approaches. If I use migrate_to_node() and it's call to check_range(), I would have to have something like the above logic to
do the per vma stuff. But, why per vma? I agree it doesn't make a lot
of sense for the kernel build workload. I find very few eligible pages to migrate, so even if I scanned the entire mm at once, the resulting page list would be very small. However, I was concerned about tying up a large number of pages, isolated from the LRU, for applications with larger footprints. I'm also going to experiment with more agressive migration--i.e., selecting pages with >1 map counts. This may result in larger numbers of pages migrating.
But, I have thought about adding internal flags to steer different paths through migrate_to_node() and check_range(). If we ever get serious about including an automigration mechanism like this, I'll go ahead and take a look at it.
Lee
Lee
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · Lee Schermerhorn
Quoted 2 lines
Could you add some special casing instead to
migrate_to_nodeand/orcheck_range?I think this could be done. Don't know whether the results would be "pretty" or not.
Make it as pretty as possible.
Quoted 11 lines
Currently, you'll note that I'm calling
check_rangefor one vma at a time. I'm not sure this is a good idea. It probably adds overhead revisiting upper level page table pages many times. But, I want to compare different approaches. If I usemigrate_to_node()and it's call tocheck_range(), I would have to have something like the above logic to
do the per vma stuff. But, why per vma? I agree it doesn't make a lot
of sense for the kernel build workload. I find very few eligible pages to migrate, so even if I scanned the entire mm at once, the resulting page list would be very small. However, I was concerned about tying up a large number of pages, isolated from the LRU, for applications with larger footprints. I'm also going to experiment with more agressive
Well if you just find a few pages to migrate then the pages isolated from the LRU will also be few.
Quoted 2 lines
migration--i.e., selecting pages with >1 map counts. This may result in larger numbers of pages migrating.
Yes and doing so may stall the concurrent compiler passes.
Quoted 4 lines
But, I have thought about adding internal flags to steer different paths through
migrate_to_node()andcheck_range(). If we ever get serious about including an automigration mechanism like this, I'll go ahead and take a look at it.
Ok.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>