# torvalds/linux architecture

> Architecture diagram of the GitHub repository torvalds/linux, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/torvalds/linux
- Repository: https://github.com/torvalds/linux
- Video tour (about a minute): https://gitdiagram.com/torvalds/linux/video

## Overview

Linux is an operating-system kernel: it mediates hardware and system resources to provide services to userspace. The broad workflow is userspace requests entering kernel services and reaching hardware or managed resources; the README identifies memory management, scheduling, networking, filesystems, and power management as major capabilities. The supplied source samples show concrete driver and subsystem internals, not the full request path or boot sequence, so those broader connections are documented or marked unverified rather than inferred from imports. The graph emphasizes sampled implementations and the substantial indexed Xe, Komeda, DMA, and mass-storage modules.

Main entry points: [`init/main.c`](https://github.com/torvalds/linux/blob/master/init/main.c) (Kernel entry), [`drivers/gpu/drm/xe/xe_hw_engine.c`](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_hw_engine.c) (Xe hardware engines), [`drivers/gpu/drm/xe/xe_device.h`](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_device.h) (Xe device model), [`drivers/usb/gadget/function/f_mass_storage.c`](https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_mass_storage.c) (USB mass storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Kernel services"]
  node_kernel_entry["Kernel entry<br/>[main.c]"]
  node_memory["Memory management"]
  node_scheduler["Task scheduling"]
  node_networking["Networking stack"]
  node_filesystems["Filesystems"]
  node_power["Power management<br/>[main.c]"]
end

subgraph group_drivers["Device drivers"]
  node_dma_api["DMA engine API<br/>[dmaengine.c]"]
  node_ccp_dma["CCP DMA driver<br/>[ccp-dmaengine.c]"]
  node_crypto_engine["Crypto request engine<br/>[crypto_engine.c]"]
  node_qaic_mhi["QAIC MHI controller<br/>[mhi_controller.c]"]
  node_pnp_resources["PnP resource manager<br/>[manager.c]"]
  node_mass_storage["USB mass storage<br/>[f_mass_storage.c]"]
end

subgraph group_graphics["Graphics"]
  node_komeda_state["Komeda pipeline state"]
  node_komeda_pipeline["Komeda pipeline model<br/>[komeda_pipeline.h]"]
  node_xe_engine["Xe hardware engines<br/>[xe_hw_engine.c]"]
  node_xe_device["Xe device model<br/>[xe_device.h]"]
  node_xe_bo["Xe buffer objects<br/>[xe_bo.h]"]
  node_xe_vm["Xe virtual memory<br/>[xe_vm.h]"]
  node_xe_gt_types["Xe GT state<br/>[xe_gt_types.h]"]
  node_xe_rtp["Xe register programming<br/>[xe_rtp.h]"]
end

subgraph group_architecture["Architecture support"]
  node_guarded_storage["Guarded storage support<br/>[guarded_storage.c]"]
  node_system_manager["PS3 system manager<br/>[ps3-sys-manager.c]"]
end

node_userspace(("Userspace software"))
node_storage_media[("Backing media files")]
node_hardware(("Platform hardware"))

node_userspace -.->|"requests services"| node_kernel_entry
node_kernel_entry -.->|"provides resources"| node_memory
node_kernel_entry -.->|"provides services"| node_scheduler
node_kernel_entry -.->|"provides services"| node_networking
node_kernel_entry -.->|"provides services"| node_filesystems
node_kernel_entry -.->|"manages power"| node_power
node_dma_api -.->|"serves DMA client"| node_ccp_dma
node_userspace -.->|"uses USB storage"| node_mass_storage
node_mass_storage -->|"reads and writes"| node_storage_media
node_komeda_state -->|"configures state"| node_komeda_pipeline
node_xe_engine -->|"processes settings"| node_xe_rtp
node_xe_device -.->|"owns engines"| node_xe_engine
node_xe_engine -->|"uses GT state"| node_xe_gt_types
node_xe_device -.->|"manages buffers"| node_xe_bo
node_xe_bo -.->|"maps into address spaces"| node_xe_vm
node_guarded_storage -->|"handles syscall"| node_userspace
node_system_manager -.->|"communicates with"| node_hardware
node_pnp_resources -.->|"assigns resources"| node_hardware

click node_kernel_entry "https://github.com/torvalds/linux/blob/master/init/main.c"
click node_memory "https://github.com/torvalds/linux/tree/master/arch/alpha/mm"
click node_scheduler "https://github.com/torvalds/linux/tree/master/arch/alpha/kernel"
click node_power "https://github.com/torvalds/linux/blob/master/drivers/base/power/main.c"
click node_dma_api "https://github.com/torvalds/linux/blob/master/drivers/dma/dmaengine.c"
click node_ccp_dma "https://github.com/torvalds/linux/blob/master/drivers/crypto/ccp/ccp-dmaengine.c"
click node_crypto_engine "https://github.com/torvalds/linux/blob/master/crypto/crypto_engine.c"
click node_qaic_mhi "https://github.com/torvalds/linux/blob/master/drivers/accel/qaic/mhi_controller.c"
click node_pnp_resources "https://github.com/torvalds/linux/blob/master/drivers/pnp/manager.c"
click node_mass_storage "https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_mass_storage.c"
click node_komeda_state "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c"
click node_komeda_pipeline "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h"
click node_xe_engine "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_hw_engine.c"
click node_xe_device "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_device.h"
click node_xe_bo "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_bo.h"
click node_xe_vm "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_vm.h"
click node_xe_gt_types "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_gt_types.h"
click node_xe_rtp "https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_rtp.h"
click node_guarded_storage "https://github.com/torvalds/linux/blob/master/arch/s390/kernel/guarded_storage.c"
click node_system_manager "https://github.com/torvalds/linux/blob/master/drivers/ps3/ps3-sys-manager.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_kernel_entry,node_memory,node_scheduler,node_networking,node_filesystems,node_power,node_userspace toneBlue
class node_dma_api,node_ccp_dma,node_crypto_engine,node_qaic_mhi,node_pnp_resources,node_mass_storage,node_storage_media toneAmber
class node_komeda_state,node_komeda_pipeline,node_xe_engine,node_xe_device,node_xe_bo,node_xe_vm,node_xe_gt_types,node_xe_rtp toneMint
class node_guarded_storage,node_system_manager toneRose
class node_hardware toneIndigo
```

## Components

### Kernel services

- [Kernel entry](https://github.com/torvalds/linux/blob/master/init/main.c): `init/main.c`
- [Memory management](https://github.com/torvalds/linux/tree/master/arch/alpha/mm): `arch/alpha/mm`
- [Task scheduling](https://github.com/torvalds/linux/tree/master/arch/alpha/kernel): `arch/alpha/kernel`
- **Networking stack**
- **Filesystems**
- [Power management](https://github.com/torvalds/linux/blob/master/drivers/base/power/main.c): `drivers/base/power/main.c`

### Device drivers

- [DMA engine API](https://github.com/torvalds/linux/blob/master/drivers/dma/dmaengine.c): `drivers/dma/dmaengine.c`
- [CCP DMA driver](https://github.com/torvalds/linux/blob/master/drivers/crypto/ccp/ccp-dmaengine.c): `drivers/crypto/ccp/ccp-dmaengine.c`
- [Crypto request engine](https://github.com/torvalds/linux/blob/master/crypto/crypto_engine.c): `crypto/crypto_engine.c`
- [QAIC MHI controller](https://github.com/torvalds/linux/blob/master/drivers/accel/qaic/mhi_controller.c): `drivers/accel/qaic/mhi_controller.c`
- [PnP resource manager](https://github.com/torvalds/linux/blob/master/drivers/pnp/manager.c): `drivers/pnp/manager.c`
- [USB mass storage](https://github.com/torvalds/linux/blob/master/drivers/usb/gadget/function/f_mass_storage.c): `drivers/usb/gadget/function/f_mass_storage.c`

### Graphics

- [Komeda pipeline state](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c): `drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c`
- [Komeda pipeline model](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h): `drivers/gpu/drm/arm/display/komeda/komeda_pipeline.h`
- [Xe hardware engines](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_hw_engine.c): `drivers/gpu/drm/xe/xe_hw_engine.c`
- [Xe device model](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_device.h): `drivers/gpu/drm/xe/xe_device.h`
- [Xe buffer objects](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_bo.h): `drivers/gpu/drm/xe/xe_bo.h`
- [Xe virtual memory](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_vm.h): `drivers/gpu/drm/xe/xe_vm.h`
- [Xe GT state](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_gt_types.h): `drivers/gpu/drm/xe/xe_gt_types.h`
- [Xe register programming](https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/xe/xe_rtp.h): `drivers/gpu/drm/xe/xe_rtp.h`

### Architecture support

- [Guarded storage support](https://github.com/torvalds/linux/blob/master/arch/s390/kernel/guarded_storage.c): `arch/s390/kernel/guarded_storage.c`
- [PS3 system manager](https://github.com/torvalds/linux/blob/master/drivers/ps3/ps3-sys-manager.c): `drivers/ps3/ps3-sys-manager.c`

### Other components

- **Userspace software**
- **Backing media files**
- **Platform hardware**

## Connections

- Userspace software → Kernel entry: requests services (evidence: `README`)
- Kernel entry → Memory management: provides resources (evidence: `README`)
- Kernel entry → Task scheduling: provides services (evidence: `README`)
- Kernel entry → Networking stack: provides services (evidence: `README`)
- Kernel entry → Filesystems: provides services (evidence: `README`)
- Kernel entry → Power management: manages power (evidence: `README`)
- DMA engine API → CCP DMA driver: serves DMA client
- Userspace software → USB mass storage: uses USB storage
- USB mass storage → Backing media files: reads and writes (evidence: `drivers/usb/gadget/function/f_mass_storage.c`)
- Komeda pipeline state → Komeda pipeline model: configures state (evidence: `drivers/gpu/drm/arm/display/komeda/komeda_pipeline_state.c`)
- Xe hardware engines → Xe register programming: processes settings (evidence: `drivers/gpu/drm/xe/xe_hw_engine.c`)
- Xe device model → Xe hardware engines: owns engines (evidence: `drivers/gpu/drm/xe/xe_hw_engine.c`)
- Xe hardware engines → Xe GT state: uses GT state (evidence: `drivers/gpu/drm/xe/xe_hw_engine.c`)
- Xe device model → Xe buffer objects: manages buffers
- Xe buffer objects → Xe virtual memory: maps into address spaces (evidence: `drivers/gpu/drm/xe/xe_bo.h`)
- Guarded storage support → Userspace software: handles syscall (evidence: `arch/s390/kernel/guarded_storage.c`)
- PS3 system manager → Platform hardware: communicates with
- PnP resource manager → Platform hardware: assigns resources
