1
0
Fork 0
remarkable-linux/include
KAMEZAWA Hiroyuki a3b2d69269 cgroups: use css id in swap cgroup for saving memory v5
Try to use CSS ID for records in swap_cgroup.  By this, on 64bit machine,
size of swap_cgroup goes down to 2 bytes from 8bytes.

This means, when 2GB of swap is equipped, (assume the page size is 4096bytes)

	From size of swap_cgroup = 2G/4k * 8 = 4Mbytes.
	To   size of swap_cgroup = 2G/4k * 2 = 1Mbytes.

Reduction is large.  Of course, there are trade-offs.  This CSS ID will
add overhead to swap-in/swap-out/swap-free.

But in general,
  - swap is a resource which the user tend to avoid use.
  - If swap is never used, swap_cgroup area is not used.
  - Reading traditional manuals, size of swap should be proportional to
    size of memory. Memory size of machine is increasing now.

I think reducing size of swap_cgroup makes sense.

Note:
  - ID->CSS lookup routine has no locks, it's under RCU-Read-Side.
  - memcg can be obsolete at rmdir() but not freed while refcnt from
    swap_cgroup is available.

Changelog v4->v5:
 - reworked on to memcg-charge-swapcache-to-proper-memcg.patch
Changlog ->v4:
 - fixed not configured case.
 - deleted unnecessary comments.
 - fixed NULL pointer bug.
 - fixed message in dmesg.

[nishimura@mxp.nes.nec.co.jp: css_tryget can be called twice in !PageCgroupUsed case]
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Li Zefan <lizf@cn.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Paul Menage <menage@google.com>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: 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>
2009-04-02 19:04:56 -07:00
..
acpi acpi/x86: introduce __apci_map_table, v4 2009-02-09 13:35:07 +01:00
asm-arm S3C24XX: Move and update IIS headers 2009-03-05 12:00:59 +00:00
asm-frv mm: use debug_kmap_atomic 2009-04-01 08:59:14 -07:00
asm-generic gpiolib: allow GPIOs to be named 2009-04-02 19:04:51 -07:00
asm-h8300
asm-m32r Merge branch 'header-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-03-26 16:11:41 -07:00
asm-mn10300 mm: use debug_kmap_atomic 2009-04-01 08:59:14 -07:00
crypto crypto: zlib - New zlib crypto module, using pcomp 2009-03-04 15:16:19 +08:00
drm drm: detect hdmi monitor by hdmi identifier (v3) 2009-03-29 18:31:49 +10:00
keys
linux cgroups: use css id in swap cgroup for saving memory v5 2009-04-02 19:04:56 -07:00
math-emu
media V4L/DVB (11313): v4l2-subdev: add enum_framesizes and enum_frameintervals. 2009-03-30 12:43:49 -03:00
mtd make MTD headers use strict integer types 2009-03-26 18:14:17 +01:00
net netlabel: Cleanup the Smack/NetLabel code to fix incoming TCP connections 2009-03-28 15:01:37 +11:00
pcmcia
rdma Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2009-03-26 15:54:36 -07:00
rxrpc
scsi [SCSI] iscsi class: remove host no argument from session creation callout 2009-03-13 15:29:39 -05:00
sound V4L/DVB (10771): tea575x-tuner: convert it to V4L2 API 2009-03-30 12:43:02 -03:00
trace net: Add dependent headers to trace/skb.h 2009-03-24 14:24:10 -07:00
video fbdev: update s1d13xxxfb to differ between revisions and production ids 2009-04-01 08:59:32 -07:00
xen
Kbuild