{"id":17949815,"url":"https://github.com/gurugio/book_linuxkernel_blockdrv","last_synced_at":"2025-07-13T16:33:11.365Z","repository":{"id":151937175,"uuid":"75822052","full_name":"gurugio/book_linuxkernel_blockdrv","owner":"gurugio","description":"Learn how multi-queue block device in Linux kernel v4.4 works","archived":false,"fork":false,"pushed_at":"2024-07-27T17:00:50.000Z","size":480,"stargazers_count":77,"open_issues_count":0,"forks_count":16,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-01-22T11:07:15.633Z","etag":null,"topics":["device-driver","driver","linux-kernel","multi-queue"],"latest_commit_sha":null,"homepage":"","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gurugio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-07T09:47:03.000Z","updated_at":"2025-01-14T18:32:19.000Z","dependencies_parsed_at":"2024-08-02T16:17:28.775Z","dependency_job_id":null,"html_url":"https://github.com/gurugio/book_linuxkernel_blockdrv","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurugio%2Fbook_linuxkernel_blockdrv","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurugio%2Fbook_linuxkernel_blockdrv/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurugio%2Fbook_linuxkernel_blockdrv/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gurugio%2Fbook_linuxkernel_blockdrv/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gurugio","download_url":"https://codeload.github.com/gurugio/book_linuxkernel_blockdrv/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236317035,"owners_count":19129542,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["device-driver","driver","linux-kernel","multi-queue"],"created_at":"2024-10-29T09:34:18.658Z","updated_at":"2025-01-30T08:11:56.138Z","avatar_url":"https://github.com/gurugio.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"_First, thank you for taking the time to read my book! I want to point out that English is not my first language and you're welcome to give me any feedback for my poor English._\n\n# Multi-queue block device in Linux kernel v4.4\n\nSeveral years ago, a new concept was merged into the block layer of Linux kernel. Before that every single block device has one queue for IO handling. Every processes inserted an IO request into the queue and block device driver extract a request from the queue. Yes, one queue was shared for many processes and for many processors.\n\nWhen we used HDD mainly, a single queue did not matter. But these days SSD is so popular that a single queue design has been bottle-neck of performance. Therefore kernel developers implemented the multi-queue design.\n\nThat is not just an adding more queues. The architecture of block layer must've re-designed. You can get the theoritical background from this paper: \n\n\u003e Bjørling, Matias, et al. \"Linux block IO: Introducing multi-queue SSD access on multi-core systems.\" Proceedings of the 6th International Systems and Storage Conference. ACM, 2013. - http://kernel.dk/systor13-final18.pdf\n\nThis document shows the step-by-step process of making mybrd driver that is mimic of brd and null_blk drivers in Linux v4.4. We begin with dummy skeleton driver. And we will make a single queue and see how it works. And also we will see how kernel pass the IO request to driver via the single queue. Finally we will change mybrd driver to have multi-queue and see how it works between kernel block layer and driver.\n\nThe final source code is already implemented at https://github.com/gurugio/mybrd/blob/master/mybrd.c. So you can see what this document aim to do now. I'll also describe a few more features of kernel because they are necessary to understand and implement the block device driver.\n\nI hope this document can guide you to the deep inside of Linux kernel.\n\n\nPS.\n\nThis document is not for very beginner of Linux kernel. A small document cannot describe details beginner should know to start Linux kernel. If you already started Linux kernel and read one or two books, but did not know what to do next, this document can be good for you.\n\nPS.\n\nIf you are interested in memory management, you'd better start reading Mel Gorman's book.\n\nhttps://www.kernel.org/doc/gorman/pdf/understand.pdf\n\n\n# INDEX\n\n* [prepare](environment.md)\n* [skeleton of mybrd](mybrd_skeleton.md)\n* [disk](create_disk.md)\n* [ramdisk](create_ramdisk.md)\n* [request-mode](request-mode.md)\n* [multiqueue-mode](multiqueue-mode.md)\n* [pagecache and blockdriver](pagecacheand_blockdriver.md)\n* [experiement for the page cache](pagecache_ex.md)\n* [page-flags](page-flags.md)\n* [system calls and flushing block device](systemcall_flushblock.md)\n* [per-cpu variable and statistics (v2.6.11)](per-cpu_statistics.md)\n* [wait-queue](wait-queue.md)\n* [spinlock](spinlock.md)\n* [work-queue](work-queue.md)\n* [RCU](read-copy-update.md)\n\n\n# references\n\n* Documentation/block/\n* https://www.thomas-krenn.com/en/wiki/Linux_Storage_Stack_Diagram#Diagram_for_Linux_Kernel_4.10\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgurugio%2Fbook_linuxkernel_blockdrv","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgurugio%2Fbook_linuxkernel_blockdrv","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgurugio%2Fbook_linuxkernel_blockdrv/lists"}