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
0 answers

mbind: how to uniformly interleave existing segment on all nodes?

Using mbind, one can set the memory policy for a given mapped memory segment. Q: How can I tell mbind to interleave a segment on all nodes? If done after allocation but before usage, MPOL_INTERLEAVE on all nodes will do what we expect -- memory will…
João Neto
  • 1,732
  • 17
  • 28
6
votes
1 answer

How are requests to /dev/(u)random etc. handled in Docker?

for documentation purposes on our project I am looking for the following information: We are using Docker to deploy various applications which require entropy for SSL/TLS and other stuff. These applications may use /dev/random, /dev/random,…
Thomas
  • 63
  • 1
  • 7
6
votes
2 answers

Detect if running on a device with heterogeneous CPU architecture

I'm very specific on this one. I need to know if the device has a CPU which has heterogeneous cores like ARM's big.LITTLE technology, for instance, a set of 4 ARM Cortex-A53 + another set of 4 more powerfull ARM Cortex-A72, totaling 8 cores,…
Lennoard Silva
  • 767
  • 1
  • 8
  • 17
6
votes
5 answers

Compiling Kernel code in Linux

Okay, I'm reading about Linux kernel development and there are some code snippets using kernel's data structures and stuff. Let's say I'd like to experiment with them, e.g. there's a very simple snippet: #include…
Albus Dumbledore
  • 12,368
  • 23
  • 64
  • 105
6
votes
2 answers

How does spin_lock_bh() work?

I have a device driver I am working with that has a shared resource between the ISR (more specifically the bottom half of the ISR) and the read() call. The ISR does nothing more than call schedule_work() to get the bottom half to do the heavy…
It'sPete
  • 5,083
  • 8
  • 39
  • 72
6
votes
1 answer

Kernel block device

I'm currently trying to implement a (not that ?) simple kernel block device driver. I inspired mainly from the book Linux Device Drivers, 3rd Edition which is not totally up-to-date anymore as it was published in 2005. Anyway the logic is still…
Arkaik
  • 852
  • 2
  • 19
  • 39
6
votes
2 answers

ionice 'idle' not having the expected effects

We're working with a reasonably busy web server. We wanted to use rsync to do some data-moving which was clearly going to hammer the magnetic disk, so we used ionice to put the rsync process in the idle class. The queues for both disks on the system…
Neilski
  • 85
  • 10
6
votes
2 answers

Is cap_dac_override a superset of cap_dac_read_search?

I'm working on limiting capabilities of an existing, complex application and I have been searching for a while for a credible source proving that permissions included in cap_dac_override are a superset of cap_dac_read_search. It seems logical that…
tomix86
  • 1,336
  • 2
  • 18
  • 29
6
votes
1 answer

BPF: owner of a map

This is follow-up to who creates map in BPF since my new question is not directly relevant that thread. So, it seems to me that there has to be a single point where a BPF map is created, either it is a bpf program or a user program that loads bpf…
Mark
  • 6,052
  • 8
  • 61
  • 129
6
votes
0 answers

resizing file size with ftruncate() after mmap()

The code snippet works fine on my machine(Linux/x86-64) int main() { char* addr; int rc; int fd; const size_t PAGE_SIZE = 4096; // assuming the page size is 4096 char buf[PAGE_SIZE]; memset(buf, 'x', sizeof(buf)); // error checking…
tristan
  • 4,235
  • 2
  • 21
  • 45
6
votes
1 answer

Socket error:90:Message Too Long

I have an error from the following scenario with IGMP socket call; fd = socket(PF_INET, SOCK_RAW, IPPROTO_IGMP) ; setsockopt( fd, IPPROTO_IP, IP_HDRINCL, nval, sizeof(nval) ); /** Fill in the IP header and Ethernet header**/ /*** Fill, create the…
Sathya
  • 81
  • 1
  • 1
  • 3
6
votes
1 answer

how to build BPF program out of the kernel tree

The kernel provides a number of examples in samples/bpf. I am interested in building one of examples outside of the tree, just like we build a kernel module, where Makefile can be simple enough. Is it possible to do the same with bpf? I tried it by…
Mark
  • 6,052
  • 8
  • 61
  • 129
6
votes
1 answer

Are the Linux/SMP spinlocks unnecessarily slow?

Having been reading through Understanding the Linux kernel (Bovet & Cesati), the chapter on Kernel Synchronisation states that the spin lock acquisition code boils down to: 1: lock: btsl $0, slp jnc 3 2: testb $1, slp jne 2 …
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
6
votes
1 answer

Is it possible for a user process to tell the OS to relocate the mapping done by mmap to other NUMA node?

Consider this scenario: a user process running on a NUMA machine calls mmap to creates a new mapping in the virtual address space. It then uses the memory returned by mmap for its processing (storing its data,...). Now for some reasons, the user…
Bao Bui
  • 185
  • 2
  • 6
6
votes
3 answers

How to get RGB pixel values from Linux framebuffer?

I want to get RGB values of screen pixels in the most efficient way, using Linux. So I decided to use the framebuffer library in C (fb.h) to access the framebuffer device (/dev/fb0) and read from it directly. This is the code: #include…
Sergio
  • 844
  • 2
  • 9
  • 26