lca13: memory hotplug on android

18
Memory Hotplug on Android

Upload: linaro

Post on 25-Jun-2015

500 views

Category:

Technology


2 download

DESCRIPTION

Resource: LCA13 Name: Memory Hotplug on Android Date: 08-03-2013 Speaker: Zach Pfeffer

TRANSCRIPT

Page 2: LCA13: Memory Hotplug on Android

Memory Hotplug

● Increase/decrease the amount of memory at runtime

○ Two modes■ Logical Memory Hotplug■ Physical Memory Hotplug

Page 3: LCA13: Memory Hotplug on Android

Server Memory Hotplug

● Change the amount of memory● Install/remove DIMMs or NUMA-nodes

Page 4: LCA13: Memory Hotplug on Android

Mobile Memory Hotplug

● Increase/decrease the amount of memory at runtime

○ Power down memory to save power■ logical memory hotplug

Page 5: LCA13: Memory Hotplug on Android

Memory Hotplug Mobile Challenges

● Userspace driven○ echo offline >

/sys/devices/system/memory/memoryXXX/state

● Minutes to offline● Can fail

Page 6: LCA13: Memory Hotplug on Android

RAM Power Management

● Temperature Compensated Self Refresh (TCSR)

● Partial Array Self Refresh (PASR)● Deep Power-Down (DPD)

Page 7: LCA13: Memory Hotplug on Android

RAM Power Management [1]

● Automatic○ Temperature Compensated Self

Refresh (TCSR)■ When a RAM is cold the refresh

interval can be extended (saving power) [2]

■ Automatic

Page 8: LCA13: Memory Hotplug on Android

RAM Power Management [1]

● Manual○ Partial Array Self Refresh (PASR)

■ Can power down chunks (64 MB)■ Works with interleaved

○ Deep Power-Down (DPD)

Page 9: LCA13: Memory Hotplug on Android

RAM Power Management [1]

● Does this matter?○ 5% savings [2] (50 mW out of 1 W)

■ This is at runtime■ Can ship devices with less memory

● Yes Tim Bird, I can ship a 32 MB Android device

Page 10: LCA13: Memory Hotplug on Android

RAM Power Management [1]

● If big.LITTLE save 150 mW○ Assumptions

■ A9 core uses 300 mW■ A15 of this order■ A7 cores use 150 mW (look at the

radio usage)■ This is 15% power savings

Page 11: LCA13: Memory Hotplug on Android

Hack Approach

● Set aside a buffer apart from the kernel on PASR boundary

● On suspend, activate PASR○ Assumes buffer contents not important

Page 12: LCA13: Memory Hotplug on Android

Linux Approach

● Use a balloon that allocates from a Contiguous Memory Allocation (CMA) region during suspend

Page 13: LCA13: Memory Hotplug on Android

Mel Gorman's Idea (from Maxime)

1. Declare CMA big enough for PASR or DPD

2. At runtime, no CMA allocationsa. Linux uses the memory (cache,

userspace i.e. movable) (Questions)3. On idle, inflate the balloon

a. Allocate CMA buffers in the regionb. Pages are migrated (userspace) or

dropped (cache)

Page 14: LCA13: Memory Hotplug on Android

Mel Gorman's Idea Cont...4. If there's memory pressure during balloon

inflation Android's low memory killer kills lower rated processes or balloon inflation can stop

5. On wake-up deflate the balloon or wait until there's memory pressure to deflate it

Page 15: LCA13: Memory Hotplug on Android

Issues1. QoS

a. Some apps that need huge memory allocations can't fail (Camera)

2. Latencya. Some apps that need huge memory

allocations need to launch "fast."3. Hand of God

a. Two level VM scheme in Linux?

Page 16: LCA13: Memory Hotplug on Android

Future1. SMMU's coming, will help

Page 17: LCA13: Memory Hotplug on Android

Maxime Coquelin, ST-E

● First RFC○ http://lwn.net/Articles/478049/○ https://lkml.org/lkml/2012/1/30/215

● Second RFC [3]○ In progress

Page 18: LCA13: Memory Hotplug on Android

Docs

1. TN-46-12: Mobile DRAM Power-Saving Features/Calculations Introduction2. TECHNICAL NOTE Low Power Function of Mobile RAM Auto Temperature Compensated Self Refresh (ATCSR)

Technical Note E0599E20 (Ver.2.0)3. http://elinux.org/images/f/f3/Lf_elc12_pallardy.pdf