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

Bypassing 4KB block size limitation on block layer/device

We are developing an ssd-type storage hardware device that can take read/write request for big block size >4KB at a time (even in MBs size). My understanding is that linux and its filesystem will "chop down" files into 4KB block size that will be…
electro
  • 911
  • 4
  • 12
  • 28
6
votes
5 answers

Segmentation in Linux : Segmentation & Paging are redundant?

I'm reading "Understanding Linux Kernel". This is the snippet that explains how Linux uses Segmentation which I didn't understand. Segmentation has been included in 80 x 86 microprocessors to encourage programmers to split their applications…
claws
  • 52,236
  • 58
  • 146
  • 195
6
votes
2 answers

What is wmb() in linux driver

In one of the PCI DMA driver i have seen wmb() many times. What actually does wmb() function do? Somewhere its mentioned as "holy water that doesn't hurts". Whats the purpose of that function?
0xAB1E
  • 721
  • 10
  • 27
6
votes
2 answers

User Permission check on ioctl command

I am implementing char driver ( Linux) and there are certain IOCTL commands are there in my driver which needs to be only executed by ADMIN. My question is how can I check user permission under my ioctl command implementation and restrict…
Nishith Goswami
  • 353
  • 5
  • 13
6
votes
1 answer

Optimize socket data transfer over loopback wrt NUMA

I was looking over the Linux loopback and IP network data handling, and it seems that there is no code to cover the case where 2 CPUs on different sockets are passing data via the loopback. I think it should be possible to detect this condition and…
jxh
  • 69,070
  • 8
  • 110
  • 193
6
votes
3 answers

In Linux, physical memory pages belong to the kernel data segment are swappable or not?

I'm asking because I remember that all physical pages belong to the kernel are pinned in memory and thus are unswappable, like what is said here: http://www.cse.psu.edu/~axs53/spring01/linux/memory.ppt However, I'm reading a research paper and feel…
hebothu
  • 269
  • 1
  • 9
6
votes
1 answer

What is numpy empty doing under the hood when I allocate a massive ndarray?

I was looking at how much space numpy arrays consume in memory and I noticed a peculiar behavior: When I ran x = np.empty((1000000, 7, 64, 64), dtype=np.uint8) My computer with 16GB of memory did not crash. Instead it was sailing smoothly with 2GB…
Erotemic
  • 4,806
  • 4
  • 39
  • 80
6
votes
3 answers

GDB: lx-symbols undefined command

I am following the guide below: Debugging kernel and modules via gdb When I try to load the module symbols using the command below: (gdb) lx-symbols gdb says that the command is undefined. How do I add these helper command to gdb? gdb info:…
Chu Bun
  • 513
  • 1
  • 5
  • 17
6
votes
4 answers

How do you get a struct device for a Linux character device

I have a Linux kernel module that implements a character device driver. I've read through Linux Device Drivers and followed several tutorials. At this point, I have a simple module that provides open, release, and write file operations. I'm trying…
zmb
  • 7,605
  • 4
  • 40
  • 55
6
votes
1 answer

__context__ attribute in linux kernel

In Kernel\include\linux\compiler.h #define __acquire(x) __context__(x,1) #define __release(x) __context__(x,-1) Please help me to understand, in above statements what we are trying to achieve with context. I couldn't find Its details. I…
6
votes
2 answers

How do I embed a device tree blob, (dtb), in a linux kernel?

There should be a standard, board and architecture independent way to do this just like there is with initfamfs, no? I'm using powerpc and linux-3.10, if it matters. If there are better facilities later, I'd be interested to hear about them. And if…
K Richard Pixley
  • 617
  • 1
  • 6
  • 10
6
votes
5 answers

Linux 2.6.31 Scheduler and Multithreaded Jobs

I run massively parallel scientific computing jobs on a shared Linux computer with 24 cores. Most of the time my jobs are capable of scaling to 24 cores when nothing else is running on this computer. However, it seems like when even one…
dsimcha
  • 67,514
  • 53
  • 213
  • 334
6
votes
2 answers

Performance Overhead of Perf Event Subsystem in Linux Kernel

Performance counters for Linux are a new kernel-based subsystem that provide a framework for all things performance analysis. It covers hardware level (CPU/PMU, Performance Monitoring Unit) features and software features (software counters,…
6
votes
2 answers

Retrieving inode struct given the path to a file

I've seen lots of questions about getting a file's path from it's inode, but almost none about doing the reverse. My kernel module needs to do this to get further information about the subjects of requests passed to open(), such as its file flags or…
Melab
  • 2,594
  • 7
  • 30
  • 51
6
votes
1 answer

what is the meaning of 0xdead000000000000?

This value was appeared in the poison.h (linux source\include\linux\poison.h): /* * Architectures might want to move the poison pointer offset * into some well-recognized area such as 0xdead000000000000, * that is also not mappable by user-space…
T-tssxuan
  • 83
  • 4