Questions tagged [linux-kernel]

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers). Questions about writing userspace code in Linux should generally be tagged [linux] instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

This tag is for questions about the internals of the Linux kernel itself - particularly about writing code that runs within the context of the kernel (like kernel modules or drivers).

Questions about writing userspace code in Linux should generally be tagged instead. Since the internals of the Linux kernel are constantly changing, it is helpful to include the precise kernel version(s) that you are interested in.

The kernel is a UNIX-like kernel initially created by Linus Torvalds in 1991 and now is maintained by developers around the world.

Frequently Asked Questions

Online resources

Books

Kernel source code and source code browsers

Further reading

Mailing lists

17371 questions
36
votes
6 answers

Linux kernel device driver to DMA from a device into user-space memory

I want to get data from a DMA enabled, PCIe hardware device into user-space as quickly as possible. Q: How do I combine "direct I/O to user-space with/and/via a DMA transfer" Reading through LDD3, it seems that I need to perform a few different…
Ian Vaughan
  • 20,211
  • 13
  • 59
  • 79
36
votes
9 answers

What does it mean to say "linux kernel is preemptive"?

I read that Linux kernel is preemptive, which is different from most Unix kernels. So, what does it really mean for a kernal to be preemptive? Some analogies or examples would be better than pure theoretical explanation. ADD 1 -- 11:00 AM…
smwikipedia
  • 61,609
  • 92
  • 309
  • 482
36
votes
3 answers

How are user-level threads scheduled/created, and how are kernel level threads created?

Apologies if this question is stupid. I tried to find an answer online for quite some time, but couldn't and hence I'm asking here. I am learning threads, and I've been going through this link and this Linux Plumbers Conference 2013 videoabout…
init
  • 585
  • 5
  • 11
36
votes
7 answers

Finding original MAC address from hardware itself

Is it possible to read the MAC address from the NIC directly? I have the code below but it just reads from the layer above but not the card itself. I'm trying to figure out how to find the original MAC address of an Ethernet NIC on my Linux box. I…
Jatin Bodarya
  • 1,425
  • 2
  • 20
  • 32
35
votes
9 answers

Content for Linux Operating Systems Class

I will be TA for an operating systems class this upcoming semester. The labs will deal specifically with the Linux Kernel. What concepts/components of the Linux kernel do you think are the most important to cover in the class? What do you wish was…
Sweeney
  • 672
  • 4
  • 6
35
votes
6 answers

Measuring NUMA (Non-Uniform Memory Access). No observable asymmetry. Why?

I've tried to measure the asymmetric memory access effects of NUMA, and failed. The Experiment Performed on an Intel Xeon X5570 @ 2.93GHz, 2 CPUs, 8 cores. On a thread pinned to core 0, I allocate an array x of size 10,000,000 bytes on core 0's NUMA…
James Brock
  • 3,236
  • 1
  • 28
  • 33
35
votes
1 answer

Vim configuration for Linux kernel development

Kernel development is actually different from a traditional C project development (from my view, as a newbie). So, I always wonder what is the vim configuration of a kernel hacker. The most important is that how to navigate kernel source tree in…
Douglas Su
  • 3,214
  • 7
  • 29
  • 58
35
votes
2 answers

Software memory bit-flip detection for platforms without ECC

Most available desktop (cheap) x86 platforms now still nave no ECC memory support (Error Checking & Correction). But the rate of memory bit-flip errors is still growing (not the best SO thread, Large scale CERN 2007 study "Data integrity": "Bit…
osgx
  • 90,338
  • 53
  • 357
  • 513
35
votes
3 answers

When to use kernel threads vs workqueues in the linux kernel

There are many ways to schedule work in the linux kernel: timers, tasklets, work queues, and kernel threads. What are the guidelines for when to use one vs another? There are the obvious factors: timer functions and tasklets cannot sleep, so they…
Jamey Hicks
  • 2,340
  • 1
  • 14
  • 20
35
votes
3 answers

perf: Couldn't record kernel reference relocation symbol

I have compiled perf for my kernel (3.11.10). During the compilation, some libraries were missing, so I have installed those. But now when I run perf, I get following message: Couldn't record kernel reference relocation symbol Symbol resolution may…
Martin Vegter
  • 136
  • 9
  • 32
  • 56
35
votes
1 answer

What is the meaning of question marks '?' in Linux kernel panic call traces?

The Call Trace contains entries like that: [] FunctionName+0xAB/0xCD [module_name] [] ? AnotherFunctionName+0x12/0x40 [module_name] [] ClearFunctionName+0x88/0x88 [module_name] What is the meaning of the '?' mark…
qdot
  • 6,195
  • 5
  • 44
  • 95
35
votes
3 answers

What is the "current" in Linux kernel source?

I'm studying about Linux kernel and I have a problem. I see many Linux kernel source files have current->files. So what is the current? struct file *fget(unsigned int fd) { struct file *file; struct files_struct *files = current->files; …
Kahn Cse
  • 397
  • 2
  • 5
  • 10
34
votes
3 answers

Memory mapped IO - how is it done?

I've read about the difference between port mapped IO and memory mapped IO, but I can't figure out how memory mapped Io is implemented in modern operating systems (windows or linux) What I know is that a part of the physical memory is reserved to…
paulAl
  • 949
  • 2
  • 10
  • 17
34
votes
2 answers

How to get started with Linux kernel development

I'm an android developer and I've been doing ROMs for a long time and I wanna get going with kernel development, I understand it's relating to linux kernel itself and got nothing to do with android. Problem is I can't find any online resources to…
Jack Mayerz
  • 450
  • 1
  • 5
  • 8
34
votes
6 answers

mmap, msync and linux process termination

I want to use mmap to implement persistence of certain portions of program state in a C program running under Linux by associating a fixed-size struct with a well known file name using mmap() with the MAP_SHARED flag set. For performance reasons, I…
BD at Rivenhill
  • 12,395
  • 10
  • 46
  • 49