aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>2010-03-10 18:22:13 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-03-12 18:52:36 -0500
commit7dc74be032bfcaa2f9d9e4296ff5bbddfa9e2f19 (patch)
tree8bd10dcca3cfb3f4f6a0e6222c7f2048995a7d5f /Documentation
parentb70cc5fdb445a6929a01e9c406593265b136c99d (diff)
memcg: add interface to move charge at task migration
In current memcg, charges associated with a task aren't moved to the new cgroup at task migration. Some users feel this behavior to be strange. These patches are for this feature, that is, for charging to the new cgroup and, of course, uncharging from the old cgroup at task migration. This patch adds "memory.move_charge_at_immigrate" file, which is a flag file to determine whether charges should be moved to the new cgroup at task migration or not and what type of charges should be moved. This patch also adds read and write handlers of the file. This patch also adds no-op handlers for this feature. These handlers will be implemented in later patches. And you cannot write any values other than 0 to move_charge_at_immigrate yet. Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Cc: Balbir Singh <balbir@linux.vnet.ibm.com> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Paul Menage <menage@google.com> Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/cgroups/memory.txt56
1 files changed, 54 insertions, 2 deletions
diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt
index b871f2552b45..e726fb0df719 100644
--- a/Documentation/cgroups/memory.txt
+++ b/Documentation/cgroups/memory.txt
@@ -262,10 +262,12 @@ some of the pages cached in the cgroup (page cache pages).
2624.2 Task migration 2624.2 Task migration
263 263
264When a task migrates from one cgroup to another, it's charge is not 264When a task migrates from one cgroup to another, it's charge is not
265carried forward. The pages allocated from the original cgroup still 265carried forward by default. The pages allocated from the original cgroup still
266remain charged to it, the charge is dropped when the page is freed or 266remain charged to it, the charge is dropped when the page is freed or
267reclaimed. 267reclaimed.
268 268
269Note: You can move charges of a task along with task migration. See 8.
270
2694.3 Removing a cgroup 2714.3 Removing a cgroup
270 272
271A cgroup can be removed by rmdir, but as discussed in sections 4.1 and 4.2, a 273A cgroup can be removed by rmdir, but as discussed in sections 4.1 and 4.2, a
@@ -414,7 +416,57 @@ NOTE1: Soft limits take effect over a long period of time, since they involve
414NOTE2: It is recommended to set the soft limit always below the hard limit, 416NOTE2: It is recommended to set the soft limit always below the hard limit,
415 otherwise the hard limit will take precedence. 417 otherwise the hard limit will take precedence.
416 418
4178. TODO 4198. Move charges at task migration
420
421Users can move charges associated with a task along with task migration, that
422is, uncharge task's pages from the old cgroup and charge them to the new cgroup.
423
4248.1 Interface
425
426This feature is disabled by default. It can be enabled(and disabled again) by
427writing to memory.move_charge_at_immigrate of the destination cgroup.
428
429If you want to enable it:
430
431# echo (some positive value) > memory.move_charge_at_immigrate
432
433Note: Each bits of move_charge_at_immigrate has its own meaning about what type
434 of charges should be moved. See 8.2 for details.
435Note: Charges are moved only when you move mm->owner, IOW, a leader of a thread
436 group.
437Note: If we cannot find enough space for the task in the destination cgroup, we
438 try to make space by reclaiming memory. Task migration may fail if we
439 cannot make enough space.
440Note: It can take several seconds if you move charges in giga bytes order.
441
442And if you want disable it again:
443
444# echo 0 > memory.move_charge_at_immigrate
445
4468.2 Type of charges which can be move
447
448Each bits of move_charge_at_immigrate has its own meaning about what type of
449charges should be moved.
450
451 bit | what type of charges would be moved ?
452 -----+------------------------------------------------------------------------
453 0 | A charge of an anonymous page(or swap of it) used by the target task.
454 | Those pages and swaps must be used only by the target task. You must
455 | enable Swap Extension(see 2.4) to enable move of swap charges.
456
457Note: Those pages and swaps must be charged to the old cgroup.
458Note: More type of pages(e.g. file cache, shmem,) will be supported by other
459 bits in future.
460
4618.3 TODO
462
463- Add support for other types of pages(e.g. file cache, shmem, etc.).
464- Implement madvise(2) to let users decide the vma to be moved or not to be
465 moved.
466- All of moving charge operations are done under cgroup_mutex. It's not good
467 behavior to hold the mutex too long, so we may need some trick.
468
4699. TODO
418 470
4191. Add support for accounting huge pages (as a separate controller) 4711. Add support for accounting huge pages (as a separate controller)
4202. Make per-cgroup scanner reclaim not-shared pages first 4722. Make per-cgroup scanner reclaim not-shared pages first