# Practical Enhancement of User Experience in NVMe SSDs
## 1 Introduction  
Non-volatile memory express (NVMe) is an open logical device interface specification for accessing fast storage media, such as solid-state drives (SSDs) [1; 2; 3; 4]. For SSDs to provide high-speed I/O, NVMe supports up to 64K submission and completion queues capable of queuing up to 64K commands [5; 6; 7; 8; 9; 10]. Such a scalable architecture facilitates the full utilization of the internal parallelism of SSDs [11; 12; 13; 14; 15; 16]. A multi-queue block I/O layer was introduced in the recent Linux kernel to efficiently support the NVMe SSDs in the host. This layer uses two levels of queues to improve scalability. One level is the software queues (SWQs) to alleviate the lock contention problem in multi-core environments, and the second level is the hardware queues (HWQs) to deal with some storages that support multiple dispatch queues, such as the NVMe SSDs [17; 18; 19].  
In the previous single-queue block I/O layer, all I/O requests originating from tasks running on each CPU core were handled via a single request queue (Figure 1a). This resulted in a performance bottleneck due to the lock contention for accessing the single request queue [18; 20]. In addition, it could not sufficiently exploit the potentiality of storages that support multiple dispatch queues. To alleviate these critical problems, the multi-queue block I/O layer employs two levels of queues (Figure 1b): SWQs and HWQs. The I/O requests originating from tasks running on any CPU core are first sent tothe corresponding SWQ mapped to the core. Thus, each CPU core is not required to consider the race condition caused by the access from other CPU cores. The I/O requests in the SWQ are subsequently moved to the HWQ, which is mapped to a single submission queue (SQ) and the said SWQ. The I/O requests are finally sent to the SQ, and the NVMe SSD retrieves them in a basic or weighted round-robin (WRR) fashion [17; 21; 22; 23; 24]. After being processed by the SSD device, completion messages for the I/O requests are inserted in the completion queue (CQ) grouped with the said SQ, and the insertion is notified to the host.  
This paper presents a practical scheme to enhance user experience by modifying the multi-queue block I/O layer. The main focus of this study is on the fast I/O handling of user-centric tasks, such as foreground or interactive tasks, due to their large impact on user experience [25]. The current Linux kernel does not adequately consider the urgency of the user-centric tasks, which especially issues I/O requests. To solve this problem, we first assigned higher process priorities to the user-centric tasks and identified the I/O requests originating from them in the block I/O layer. Subsequently, the structure of the multi-queue block I/O layer is modified to handle the aforementioned I/O requests as quickly as possible. Particularly, an NVMe feature that dispatches I/O requests from multiple SQs in a round-robin fashion is considered. The results obtained from various experiments demonstrated that the proposed scheme significantly enhances user experience from various perspectives.  
The remainder of this paper is organized as follows. Related works and the details of our proposed scheme are presented in Sections 2 and 3, respectively. In Section 4, we present the evaluation results of our proposed scheme with an I/O benchmark tool--_foo_, flexible I/O tester--and five open source programs. The paper is then concluded in Section 5.