---
title: "What Makes System Calls Expensive: A Linux Internals Deep Dive"
url: https://daily.dev/posts/what-makes-system-calls-expensive-a-linux-internals-deep-dive-pmcqgjl8m
source_url: https://blog.codingconfessions.com/p/what-makes-system-calls-expensive
type: article
source: "Confessions of a Code Addict"
published: 2025-09-16T18:14:15.530Z
updated: 2025-09-16T18:14:43.399Z
tags: ["performance", "linux"]
reading_time: 23
upvotes: 13
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# What Makes System Calls Expensive: A Linux Internals Deep Dive

**[Confessions of a Code Addict](https://daily.dev/sources/codeconfessions)** · 23 min read · 13 upvotes · 1 comments

## Summary

System calls are expensive operations that go beyond their kernel code execution cost. When transitioning between user and kernel space on Linux x86-64, the CPU must drain instruction pipelines, switch page tables and stacks, clear branch predictor buffers, and apply security mitigations against speculative execution attacks like Spectre. These microarchitectural disruptions force the CPU to rebuild its optimization state, making system calls significantly more costly than they appear. The article explores the Linux kernel's syscall handler, measures direct overhead using clock_gettime benchmarks, and explains indirect costs from pipeline draining and branch predictor clearing. Practical optimization strategies include using vDSO, caching values, batching I/O operations, leveraging io_uring, and utilizing eBPF to reduce kernel crossings.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://blog.codingconfessions.com/p/what-makes-system-calls-expensive>

## Community discussion

Top comments from developers on daily.dev.

**@servostar** · 0 upvotes

> Very interesting, despite knowing my faire share of x86 assembly, I never knew about vDSOs until now.

## Similar posts on daily.dev

- [Reworked System Call Entry Handling Slated For Linux 7.3](https://daily.dev/posts/reworked-system-call-entry-handling-slated-for-linux-7-3-du1elv5ms) · Phoronix · 0 upvotes · 0 comments
- [How Do I Profile eBPF Code?](https://daily.dev/posts/how-do-i-profile-ebpf-code--bcxzrgh49) · Hacker News · 0 upvotes · 0 comments
- [Medium](https://daily.dev/posts/medium-qywq6zdry) · Medium · 0 upvotes · 0 comments

---

Tags: [#performance](https://daily.dev/tags/performance), [#linux](https://daily.dev/tags/linux)

[View this post on daily.dev](https://daily.dev/posts/what-makes-system-calls-expensive-a-linux-internals-deep-dive-pmcqgjl8m)
