FAST 2015

Boosting Quasi-Asynchronous I/O
for Better Responsiveness
in Mobile Devices
FAST 2015
Daeho Jeong *+ ,Youngjae Lee + , Jin-Soo Kim
* Samsung Co., Suwon, Korea
+ Sungkyunkwan University
1
Outline
 Introduction
 Problem and Motivation
 Linux Kernel I/O Path
 Quasi-Asynchronous I/O
 Boosting QASIOs
 Evaluation
 Conclusion
2
Introduction
3
Problem and Motivation
 Launching the contacts APP
4
Problem and Motivation
 Burst Mode in the camera APP
 30 shots by touching and holding on the shot icon
 When the image size is large, performance is degraded by 19%
 Installing the angry birds APP
 4GB file is written in the background
 Average installation time increases by 35%
5
Problem and Motivation
 During installing or launching an app
 Many synchronous I/Os, such as read()’s or write()’s followed
by fsync() are issued
 Priority
 synchronous I/Os > asynchronous I/Os
 The progress of a file system operation is blocked by
undispatched asynchronous I/Os
6
Linux Kernel I/O Path
Ext4 orderd
7
Quasi-Asynchronous I/O
 Synchronous I/O
 The calling task is blocked until the I/O request is completed
 Asynchronous I/O
 Quasi-Asynchronous I/O(QASIO)
 The I/O which is seemingly asynchronous but has the
synchronous property because one or more tasks are waiting for
its completion
8
Types of Dependencies on QASIO
9
Direct Dependencies
 D meta : When modifying a metadata page
 D data : When modifying a data page
 D sync : When guaranteeing data to be written back
 D discard : When completing discard commands
 deallocate block
10
D meta
11
D meta
12
D meta
13
D meta
14
D meta
15
D sync
16
D sync
17
D sync
18
D sync
19
D sync
20
D sync
21
Indirect Dependencies
 I jhandle : When unable to obtain a journal handle
 I jcommit : When unable to complete fsync()
22
I jhandle
23
I jhandle
24
I jhandle
25
I jhandle
26
I jhandle
27
I jhandle
28
How to Boost a QASIO
 Req.(1): When a task is waiting for an asynchronous I/O’s
completion, the kernel gives information about QASIO to
the I/O scheduler
 Req.(2): The I/O scheduler should prioritize them among
asynchronous I/Os based on the hint
29
Implementation
30
Implementation 1
31
Detecting D meta
 Before a task modifies a metadata page, it obtains an
exclusive lock to the metadata page using the lock_buffer()
kernel function
lock_buffer()
Asy IO
32
Detecting D data and D sync
33
Detecting D discard
 Ext4_free_data_callback() function is called whenever the
block deallocation is required at the end of journal commit
34
Implementation 2
35
Evaluation
 Samsung Galaxy S5
 Exynos 5422 (quad Cortex-A15 & quad Cortex-A7)
 2GB DRAM
 16GB eMMC storage (S.W.: 54.5MB/s, R.W.: 10.4MB/s)
 Android platform version 4.4.2 (KitKat)
 Linux kernel version 3.10.9
36
Microbenchmarks
 M1
 creat() -> write(4KB) -> fsync() -> close()
 500 times
creat() and fsync()
D meta
QASIO
37
Microbenchmarks
 M2
 creat() -> write(1MB) -> fsync() -> close()
 200 times
38
Microbenchmarks
 M3
 creat()
 write(1KB) until file size reaches 300MB
write()
D data
QASIO
39
Microbenchmarks
 M4
 200M -> truncate(2M ) -> 0 -> write() -> 200M -> close()
 500 times
truncate()
D sync
QASIO
40
Microbenchmarks
 M5
 creat() -> write(4KB) -> fsync() -> close()
 another task truncates an existing 8GB file and writes 8GB of
data again to the file
I jcommit
D discard
QASIO
41
Real-life Scenarios
 Launching the contacts APP
44.8%
42
Real-life Scenarios
 Burst Mode in the camera APP
14.4%
43
Real-life Scenarios
 Installing the angry birds APP
11.5%
44
Conclusions
 Introduces a new type of I/O called Quasi-Asynchronous
I/O(QASIO)
 A novel scheme to detect QASIOs and boost them in the
Linux kernel
 Boosting QASIOs is effective in improving the responsiveness
of file system operations
45