android_kernel_samsung_msm8226/Documentation
KAMEZAWA Hiroyuki c780c66637 memcg: fix/change behavior of shared anon at moving task
This patch changes memcg's behavior at task_move().

At task_move(), the kernel scans a task's page table and move the changes
for mapped pages from source cgroup to target cgroup.  There has been a
bug at handling shared anonymous pages for a long time.

Before patch:
  - The spec says 'shared anonymous pages are not moved.'
  - The implementation was 'shared anonymoys pages may be moved'.
    If page_mapcount <=2, shared anonymous pages's charge were moved.

After patch:
  - The spec says 'all anonymous pages are moved'.
  - The implementation is 'all anonymous pages are moved'.

Considering usage of memcg, this will not affect user's experience.
'shared anonymous' pages only exists between a tree of processes which
don't do exec().  Moving one of process without exec() seems not sane.
For example, libcgroup will not be affected by this change.  (Anyway, no
one noticed the implementation for a long time...)

Below is a discussion log:

 - current spec/implementation are complex
 - Now, shared file caches are moved
 - It adds unclear check as page_mapcount(). To do correct check,
   we should check swap users, etc.
 - No one notice this implementation behavior. So, no one get benefit
   from the design.
 - In general, once task is moved to a cgroup for running, it will not
   be moved....
 - Finally, we have control knob as memory.move_charge_at_immigrate.

Here is a patch to allow moving shared pages, completely. This makes
memcg simpler and fix current broken code.

Change-Id: I159aee635c2b7d84f86fb8aebd9122a93ceffbdf
Suggested-by: Hugh Dickins <hughd@google.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Glauber Costa <glommer@parallels.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-05 14:22:47 +02:00
..
ABI Merge remote-tracking branch 'f2fs-stable/linux-3.4.y' into lineage-16.0 2019-08-05 14:21:53 +02:00
accounting
acpi
aoe
arm scm-mpu: Add additional memory protection options 2015-05-14 16:38:24 +05:30
ata
auxdisplay
backlight
blackfin
block
blockdev
cdrom
cgroups memcg: fix/change behavior of shared anon at moving task 2019-08-05 14:22:47 +02:00
connector
console
cpu-freq cpufreq: interactive: allow arbitrary speed / delay mappings 2013-11-20 16:37:37 -08:00
cpuidle cpuidle: make a single register function for all 2013-11-26 11:26:45 -07:00
cris
crypto
development-process
device-mapper Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
devicetree msm: kgsl: Fix direct references to HZ 2019-08-05 14:21:54 +02:00
DocBook
driver-model
dvb Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
early-userspace
EDID
fault-injection
fb
filesystems /proc/pid/status: add "Seccomp" field 2019-08-05 14:22:42 +02:00
firmware_class
frv
hid
hwmon Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
i2c Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
i2o
ia64
ide
infiniband
input
ioctl
isdn
ja_JP Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
kbuild
kdump
ko_KR
laptops
leds
m68k
make
mips
misc-devices
mmc
mn10300
mtd
namespaces
netlabel
networking Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
nfc
parisc
PCI
pcmcia
power power_supply: Add voltage_ocv property and use it for max17042 driver 2013-10-16 11:05:54 -07:00
powerpc
pps
prctl
pti
ptp
rapidio
RCU
s390
scheduler
scsi
security
serial
sh
sound Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
sparc
spi
sysctl Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
target
telephony
thermal
timers
trace
usb USB: ice40-hcd: Add ICE40 FPGA based SPI to Inter-Chip USB host driver 2014-03-12 10:46:11 +05:30
vDSO
video4linux
virtual
vm misc: Import SM-G900H kernel source code 2019-08-02 15:14:10 +02:00
w1
watchdog
wimax
x86 Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
zh_CN Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
.gitignore
00-INDEX
android.txt
applying-patches.txt
atomic_ops.txt
bad_memory.txt
basic_profiling.txt
bif-framework.txt bif: bif-core: add BIF NVM object writing support 2013-10-14 10:15:17 -07:00
binfmt_misc.txt
braille-console.txt
bt8xxgpio.txt
btmrvl.txt
BUG-HUNTING
bus-virt-phys-mapping.txt
cachetlb.txt
Changes
circular-buffers.txt
clk.txt
coccinelle.txt
CodingStyle
cpu-hotplug.txt
cpu-load.txt
cputopology.txt
crc32.txt
dcdbas.txt
debugging-modules.txt
debugging-via-ohci1394.txt
dell_rbu.txt
devices.txt
digsig.txt
DMA-API-HOWTO.txt
DMA-API.txt
DMA-attributes.txt common: DMA-mapping: add DMA_ATTR_SKIP_CPU_SYNC attribute 2014-08-18 10:34:41 -07:00
dma-buf-sharing.txt
DMA-ISA-LPC.txt
dmaengine.txt
dontdiff
dynamic-debug-howto.txt
edac.txt
eisa.txt
email-clients.txt
feature-removal-schedule.txt
flexible-arrays.txt
futex-requeue-pi.txt
gcov.txt
genlock.txt
gpio.txt
highuid.txt
HOWTO Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
hw_random.txt
hwspinlock.txt
init.txt
initrd.txt
Intel-IOMMU.txt
intel_txt.txt
io-mapping.txt
io_ordering.txt
iostats.txt
IPMI.txt
IRQ-affinity.txt
IRQ-domain.txt
IRQ.txt
irqflags-tracing.txt
isapnp.txt
java.txt
kernel-doc-nano-HOWTO.txt
kernel-docs.txt
kernel-parameters.txt Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
kmemcheck.txt
kmemleak.txt
kobject.txt
kprobes.txt
kref.txt
ldm.txt
local_ops.txt
lockdep-design.txt
lockstat.txt
lockup-watchdogs.txt
logo.gif
logo.txt
lzo.txt Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
magic-number.txt
Makefile
ManagementStyle
mca.txt
md.txt
media-framework.txt
memory-barriers.txt
memory-hotplug.txt
memory.txt
mono.txt
mutex-design.txt
nommu-mmap.txt
numastat.txt
oops-tracing.txt
padata.txt
parport-lowlevel.txt
parport.txt
pi-futex.txt
pinctrl.txt Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
pnp.txt
preempt-locking.txt
printk-formats.txt
prio_tree.txt
ramoops.txt
rbtree.txt
remoteproc.txt
rfkill.txt
robust-futex-ABI.txt
robust-futexes.txt
rpmsg.txt
rt-mutex-design.txt
rt-mutex.txt
rtc.txt
SAK.txt
SecurityBugs
serial-console.txt
sgi-ioc4.txt
sgi-visws.txt
SM501.txt
sparse.txt
spinlocks.txt
stable_api_nonsense.txt
stable_kernel_rules.txt Merge tag 'v3.4.113' into lineage-16.0 2019-08-05 14:20:47 +02:00
static-keys.txt
SubmitChecklist
SubmittingDrivers
SubmittingPatches
svga.txt
sysfs-rules.txt
sysrq.txt
unaligned-memory-access.txt
unicode.txt
unshare.txt
VGA-softcursor.txt
vgaarbiter.txt
video-output.txt
volatile-considered-harmful.txt
workqueue.txt
xz.txt
zorro.txt