Upload
votram
View
215
Download
0
Embed Size (px)
Citation preview
USENIX HotStorage ’15
Santa Clara, CA, USA, July 6~7, 2015
Suspend-aware Segment Cleaning
in Log-Structured File System
Dongil Park, Seungyong Cheon, Youjip Won
Hanyang University
Outline
Introduction
Log-structured File System and Segment Cleaning
Suspend Mode on Smartphone
Problem assessment
Suspend-aware Segment Cleaning
Design
Virtual Segment Cleaning
Utilization-based Segment Cleaning
Experiment
Conclusion
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 2
Introduction
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 3
• Flash memory based storage is widely used nowadays.
• Log-structured file system has been around for 20+ years.
• It has not been deployed on commercial devices.
• F2FS (Flash Friendly File System) is a log-structured file system
optimized for mobile device.
• F2FS is adopted in commercial mobile devices as their stock file
system.
• Motorola Droid family
• Motorola Moto X, Moto G, Moto E
• Google Nexus 9
Flash Friendly File System
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 4
F2FS shows great random write performance on flash memory.
more than 3ⅹ
source: C. Lee et al., FAST ‘15
sequential
write
sequential
read
random
write
random
read
Log-structured File System
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 5
In-place update file system
inode data
Log-structured file system
A C B CA B Disk
DiskA A B B C C A’ A’ Log
update(file A)
A’ A’
update(file A)
Log-structured File System
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 6
Segment: unit of disk write
Block: unit of write operation
Disk
Block and Segment
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 7
No data
Valid data
Invalid data
Free block
Valid block
Invalid block
Only free blocks
Valid & free blocks
No free block
Including invalid block
Free segment
Valid segment
Invalid segment
Writing in Log-structured File System
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 8
Writing data in append-only manner
A A A A
B B C C
XXXX
X X Y Y
Y Y Y Y
Y
Modify A
… … … …
… … … …
Y Z Z
… …
segment 1
(valid)
segment 2
(valid)
segment 0
(invalid)
A’ A’
A’ A’
X’ X’
Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 9
Segment cleaning
segment 1
(valid)
segment 2
(valid)
Y Y Y Y
Y
data data data data
data data data data
Y Z Z
data data
segment 0
(invalid)
A A A A
C C
XXXX
X
victim
segment
1. Select victim segment.
2. Migrate valid blocks.
3. Mark victim segment as free.
X
B
A’ A’
A’ A’ C’ C’B
Y Y
Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 10
Foreground segment cleaning: on-demand
Background segment cleaning: periodically
Two types of segment cleaning
Write
Segment
cleaning
request
time
completeI/O latency
Write
Segment
cleaning
time
request complete requestidle
period
Suspend Mode of Smartphone
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 11
Android adopts Suspend Mode to save battery
buffer
disk
task
Suspend Mode of Smartphone
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 12
Android adopts Suspend Mode to save battery
buffer
disk
task
Problem
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 13
Log-structured
File System
Log-structured file system needs
segment cleaningto generate free space
Android smartphone is
suspendedwhen screen is turned off
Does segment cleaning works well
when smartphone is suspended?
Androidvs.
Segment Cleaning and Suspend Mode
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 14
Power management
File system time
Background
segment
cleaning𝑆0 𝑆1 𝑆2 𝑆3 𝑆4 𝑆5 𝑆6 𝑆7
Suspend
Active
Segment Cleaning and Suspend Mode
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 15
Power management
File system time
Background
segment
cleaning𝑆0 𝑆1 𝑆2 𝑆3 𝑆4 𝑆5 𝑆6 𝑆7
Suspend
Active
Segment Cleaning and Suspend Mode
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 16
Power management
File system time
Background
segment
cleaning𝑆0 𝑆1 𝑆2 𝑆3 𝑆4 𝑆5 𝑆6 𝑆7
Suspend
Active
CONFLICT!!
Observation
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 17
Active period in real setting
Average 5.6 sec.
Device may be in suspend state when
Background Segment Cleaning is activated.
0%
20%
40%
60%
80%
100%
user 1 user 2
Suspend Active
About 75%
Observation
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 18
There is a large time slack
Active
Suspend
time
Average
1.8 sec.
Waiting for the wakeup events to be cleared
Design
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 19
Use the time between LCD off and entering suspend!
• CPU and I/O devices are still awaken
• Does not interfere with user and foreground apps
• Perform segment cleaning when suspending device
Virtual Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 20
victim
segment
page cache
Y Y
BB
X’ X’
Y Y Y Y
Y
… … … …
… … … …
Y Z Z
… …A A A A
C C
XXXX
X X
A’ A’
A’ A’ C’ C’
Do not migrate valid block directly
Virtual Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 21
victim
segment
page cache
Suspend routine start
Y YBB
X’ X’
Y Y Y Y
Y
… … … …
… … … …
Y Z Z
… …A A A A
C C
XXXX
X X
A’ A’
A’ A’ C’ C’
Do not migrate valid block directly
Mark page cache entry as dirty
Virtual Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 22
victim
segment
page cache
Call sys_sync()
Y Y
BBX’ X’
Y Y Y Y
Y
… … … …
… … … …
Y Z Z
… … A’ A’
A’ A’ C’ C’
Do not migrate valid block directly
Mark page cache entry as dirty
Virtual Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 23
time
LCD off sys_sync()
suspended∆
𝑉𝑆𝐶1 𝑉𝑆𝐶2 𝑉𝑆𝐶3
𝑡𝑖𝑑𝑙𝑒 𝑡𝑖𝑑𝑙𝑒
𝑉𝑆𝐶𝑖 : 𝑖𝑡ℎ Virtual Segment Cleaning
∆ : Time for processing other suspend routine
𝑡𝑖𝑑𝑙𝑒 : Idle period to throttle the amount of reclaimed segments
Too frequent segment cleaning may leads to the reduction of the NAND flash lifetime
Utilization-based Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 24
0
5
10
15
20
25
30
35
40
45
50
55
60
65
0 10 20 30 40 50 60 70 80 90 100
𝑝𝑖𝑛𝑣
(Invalid
blo
ck r
atio,
%)
𝑢 (File system utilization, %)
Threshold of file system utilization to activate SC
Idea threshold
Activate SC
Approximated threshold
𝑢: File system utilization 𝑝𝑖𝑛𝑣: Invalid block ratio
Utilization-based Segment Cleaning
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 25
300 𝑚𝑠 < 𝑡𝑖𝑑𝑙𝑒 < 900 𝑚𝑠
Segment cleaning is activated with threshold and idle period is 𝑡𝑖𝑑𝑙𝑒
Idle period between segment cleaning
• Reclaim 2 ~ 6 free segments at once
• Adaptive with file system utilization and invalid block ratio
• Using time slack between LCD off and entering suspend
Experiment
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 26
Motorola Moto G (KK 4.4.2, Linux 3.4)
Component Specification
AP Qualcomm Snapdragon 400
CPU Cortex-A7 1.2GHz Quad-core
RAM 1GB
Internal storage 8GB eMMC
File system F2FS (data), EXT4 (others)
Experiment
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 27
0
20
40
60
80
100
120
0 10 20 30 40 50 60
# o
f re
cla
imed s
egm
ents
time (min.)
Number of reclaimed segments
reclaimed 6× more segments
Original Segment cleaning, suspend on
Original Segment cleaning, suspend off
Suspend-aware Segment Cleaning, suspend on
Idle Period Model Verification
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 28
Number of reclaimed segments vs. File system utilization
2
2.5
3
3.5
4
4.5
5
5.5
6
6.5
20 30 40 50 60 70 80 90 100
Avg. # o
f re
cla
imed s
egm
en
ts
Utilization (%)
• Vary the file system utilization and the fraction of invalid blocks
• Enter suspend mode 50 times
𝑝𝑖𝑛𝑣 = 25% 𝑝𝑖𝑛𝑣 = 50% 𝑝𝑖𝑛𝑣 = 75%
increased by file system utilization
increased by invalid block ratio
2.12.3
2.32.42.7
2.9 2.9
33.7 3.9
3.9
4
Ideal value
Conclusion
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 29
• Background segment cleaning of log-structured file system and
suspend feature of Android system directly conflict with each other.
• Suspend-aware Segment Cleaning seamlessly reclaims free
segments with suspend module of the smartphone
Suspend-aware Segment Cleaning claims
6× as many segments as
the stock background segment cleaning does.
Dongil Park et al. USENIX HotStorage’15, Santa Clara, CA, July 6~7 30