Make foreground and background I/O priority different
Assign a higher I/O priority to foreground I/O compared to background
I/O to improve responsiveness of the foreground app.
The command below shows that this CL has the intended effect on a device
with kernel 5.10:
$ adb shell 'cd /dev/blkio && grep -aH . blkio.prio.class background/blkio.prio.class'
blkio.prio.class:none-to-rt
background/blkio.prio.class:restrict-to-be
From a device with an Android 6.1 kernel:
$ grep -aH . blkio.prio.class background/blkio.prio.class'
blkio.prio.class:promote-to-rt
background/blkio.prio.class:restrict-to-be
Bug: 347109476
Change-Id: I6f1ea6a89a8dfaa223e8d2a82917b4de2d7bf1cf
Signed-off-by: Bart Van Assche <bvanassche@google.com>
diff --git a/storage/init.storage.rc b/storage/init.storage.rc
index 56e8e4f..5a073d2 100644
--- a/storage/init.storage.rc
+++ b/storage/init.storage.rc
@@ -1,3 +1,11 @@
+on init
+ # Make foreground and background I/O priority different. none-to-rt was
+ # introduced in kernel 5.14. promote-to-rt was introduced in kernel 6.5.
+ # Write none-to-rt first and promote-to-rt next to support both older and
+ # newer kernel versions.
+ write /dev/blkio/blkio.prio.class none-to-rt
+ write /dev/blkio/blkio.prio.class promote-to-rt
+
on property:ro.build.type=userdebug
write /dev/sys/block/bootdevice/pixel/enable_pixel_ufs_logging 1
chown system /dev/sg3