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
6
votes
2 answers

Avoiding sleep while holding a spinlock

I've recently read section 5.5.2 (Spinlocks and Atomic Context) of LDDv3 book: Avoiding sleep while holding a lock can be more difficult; many kernel functions can sleep, and this behavior is not always well documented. Copying data to or from user…
Dmitry Krivenok
  • 326
  • 3
  • 10
6
votes
2 answers

Is "Understanding the Linux Virtual Memory Manager" by Mel Gorman too outdated?

I am trying to get a deeper understanding of the virtual memory manager of linux. If have found a book called "Understanding the Linux Virtual Memory Manager[1]" written by Mel Gorman which looks quite elaborate. Unfortunately it is based on the 2.4…
Frank Meerkötter
  • 2,778
  • 2
  • 20
  • 26
6
votes
3 answers

How does linux synchronize preempt count

http://lxr.linux.no/linux+v2.6.35/include/linux/preempt.h#L21 I am just trying get the linux source. I saw this preempt count and how does linux ensure the preempt count is atomic ? The code just increments the value. Also I have an another…
mousey
  • 11,601
  • 16
  • 52
  • 59
6
votes
1 answer

Android file descriptor leakage debuging

I our company we have a lot of ui-tests which are run on virtual/real devices. After running for some time tests randomly crashing, which I think is the result of file descriptor exceeding: I used ls /proc/${PID}/fd | wc -l and lsof -p ${PID} but…
Art
  • 903
  • 9
  • 20
6
votes
2 answers

Generating intermediate .i files (preprocessed files) when compiling Ubuntu-8.04

I'm building ubuntu-8.04 with gcc 3.4 and I need to generate the .i files, which are the output of the gcc preprocessor. I have tried adding the --save-temps flag but this only generates the .i files for the top level directory, i.e. source, and…
Sara
  • 61
  • 1
  • 2
6
votes
0 answers

How to convert virtual address to physical address from user space? Three different methods gave different results in Linux kernel 4x version

First of all, I’m sorry for so long question. I do some simulation modeling task and I need to translate user space virtual address into kernel space physical addresses. I used three different method and got three different results. Could you please…
shs_sf
  • 189
  • 2
  • 10
6
votes
1 answer

How many maximum different CPU-Cores can be used to processing of one IP-packet?

For example, we have 1 CPU with 8 Cores. How many maximum different CPU-Cores can be used to processing of one IP-packet when it going over Eth0->TCP/IP->App (exclude processing in Application)? For example, could it be 3 CPU-Cores: Process…
Alex
  • 12,578
  • 15
  • 99
  • 195
6
votes
1 answer

modinfo srcversion: How do I generate this from my source?

I have a compiled version of a linux module, and then I have about 20+ variations of its source. Through various foolish mistakes, I've lost track of which version of the source was the actual one I used to make the module. I noticed that modinfo…
Ryley
  • 21,046
  • 2
  • 67
  • 81
6
votes
1 answer

How does "fastboot boot " works internally?

Fastboot has the following handy feature (if booting the custom image fails, the device just magically boots the default image next time, and all's gonna be alright): To boot with a host-side kernel image This command allows you to download a…
jckuester
  • 277
  • 1
  • 5
  • 15
6
votes
2 answers

How to get address information from library to be shared among all processes?

In Understanding the Linux Kernel, 3rd edition, it says: Shared libraries are especially convenient on systems that provide file memory mapping, because they reduce the amount of main memory requested for executing a program. When the dynamic…
Francis
  • 91
  • 3
6
votes
3 answers

custom Linux kernel build failure in vmware workstation

While trying to compile/build and boot custom kernel inside vmware workstation, while booting new kernel, it fails and falls to shell with error "failed to find disk by uuid". I tried this with both ubuntu and centos. Things I tried but didn't…
Himanshu Sourav
  • 700
  • 1
  • 10
  • 35
6
votes
2 answers

Why are MSI interrupts not shared?

Can any body tell why MSI interrupts are not shareable in linux. PIN based interrupts can be shared by devices, but MSI interrupts are not shared by devices, each device gets its own MSI IRQ number. Why can't MSI interrupts be shared ?
valmiki
  • 701
  • 9
  • 24
6
votes
0 answers

Using the UIO driver to map a pair of interrupts or small address space

I'm working on a Zynq-7000 running Yocto and I am trying to expose a DMA controller (the AXI DMA IP block running in the FPGA fabric) to the Linux user space. In the simple case, the DMA controller has a memory space of 0x60 bytes and typically a…
6
votes
1 answer

Linux Kernel: How to capture a key press and replace it with another key?

I'm attempting to dabble with low level programming. My goal is to have a user type a key into the terminal, capture that and output another key. So for example, if the user types "a" I would type out "b", if he types in "b" I output "c", etc. What…
Abushawish
  • 1,466
  • 3
  • 20
  • 35
6
votes
2 answers

why can't I match jiffies to uptime?

As far as I know, "jiffies" in Linux kernel is the number of ticks since boot, and the number of ticks in one second is defined by "HZ", so in theory: (uptime in seconds) = jiffies / HZ But based on my tests, the above is not true. For example: $…
Wenbin
  • 63
  • 3