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

SurfaceFlinger/gralloc Out of Memory error when allocating buffer memory for use with virtual frame buffer on Android x86 Nougat

We're customizing a fork of the Android x86 Nougat (Android v7.1) project. Because there is no video display hardware in our system we're trying to setup the virtual frame buffer (VFB) so we can then handle the video display in a custom manner (e.g.…
6
votes
4 answers

Fundamental differences between Linux OS and Mobile OS (android)

Hi I'm trying to find out about what the differences are in operating systems of mobile devices compared to those in desktop machines. Specifically things like memory management, scheduling etc. I'm aware that mobile operating systems must need to…
Spawn
  • 61
  • 1
  • 1
  • 2
6
votes
1 answer

What is memory reclaim in linux

I am very new to Linux memory management. While reading some documents on the topic, I had some basic questions. Below is my config: vm.swappiness=10 vm.vfs_cache_pressure=140 vm.min_free_kbytes=2013265 My understanding is, if free memory falls…
Mohamed Ashraf
  • 91
  • 1
  • 1
  • 4
6
votes
1 answer

Linux device driver buffering strategy

Lets assume that I have an external device that is constantly pushing data into a small buffer in my driver. I'm using a wait queue where an interrupt handler wakes up a waiting user process (similar to LDD (3rd edition) - Implementing a…
jsynccurry
  • 61
  • 1
6
votes
1 answer

PAE in x86-64 bit processors - Linux kernel

I have noticed that the PAE bit in the CR4 register is turned on my Linux (3.19) x86-64 machine. The PAE feature allows physical addresses up to 64gb to be accessed but I do not understand why it is needed when long-mode is enabled. I have looked it…
Rouki
  • 2,239
  • 1
  • 24
  • 41
6
votes
2 answers

Python subprocess running in background before returning output

I have some Python code that I want to debug with perf. For that purpose I want to use subprocess. The following command returns instruction-related information of a process until the command is exited via Ctrl^C. perf stat -p Now, I want…
mozcelikors
  • 2,582
  • 8
  • 43
  • 77
6
votes
2 answers

Running Linux 4.9 on Cortex-M4 STM32F4 (29I-DISC1)

I spend a few days trying to understand but I'm stuck. I get no more than a "Starting kernel..." message after entering 'bootm 8100000' on my STM32F429I-DISC1 board. Before I update uboot from 2011 to 2016 It was a "Starting Kernel..." + UNHANDED…
svalsesia
  • 303
  • 2
  • 13
6
votes
2 answers

Why is copy_to/from_user required?

As per the linux design on x86 and ppc, the 4g virtual address space is divided into 3:1. User virtual address's are till 3g. Now if user app does an ioctl passing a pointer to buffer, the kernel module, can directly do a memcpy, I tried and it…
user435739
6
votes
2 answers

Kworker threads getting blocked by SCHED_RR userspace threads

We have a Linux system using kernel 3.14.17, PREEMPT RT. It is a single core system. For latency issues, our application has some of its threads' scheduling type set to SCHED_RR. However, this causes the kworkers in the kernel to be blocked, as they…
raahlb
  • 195
  • 2
  • 10
6
votes
2 answers

How do I access any kernel symbol in a kernel module?

I am wanting to use the function getname in my kernel module. It is not exported. Since I am running into this problem right now, I would like to know how to access and use any kernel symbol that is not exported. I figure that the steps necessary to…
Melab
  • 2,594
  • 7
  • 30
  • 51
6
votes
1 answer

Tools for scheduler debugging in Linux

I have an embedded linux system containing two threads that must run in real time (or soft real time). When using SCHED_OTHER, I noted a lot of jitter but the two threads always executed within their allocated time. I have applied the RT patch with…
Jary
  • 1,501
  • 3
  • 24
  • 35
6
votes
0 answers

Can't find kobject for use in sysfs_notify()

I am working on a driver that creates a sysfs attribute file. It is intended that an application be notified of changes to this attribute by using the poll() method. I intend to use the sysfs_notify() function for this. This is easy to do as long…
DJM
  • 61
  • 2
6
votes
3 answers

C Standard Library Functions vs. System Calls. Which is `open()`?

I know fopen() is in the C standard library, so that I can definitely call the fopen() function in a C program. What I am confused about is why I can call the open() function as well. open() should be a system call, so it is not a C function in the…
Tianyi
  • 85
  • 1
  • 2
6
votes
1 answer

What are the factor on which PID_MAX depends in Linux

I have checked two linux systems, both were of 64 bit but PID_MAX is different for both of them. On one system(SYSTEM1) cat /proc/sys/kernel/pid_max 32768 SYSTEM1 configuration: dmesg | grep -i smp.*allow getconf PAGESIZE 4096 cat /proc/cpuinfo…
SACHIN GOYAL
  • 955
  • 6
  • 19
6
votes
1 answer

How to add a dependency on a generated source file in Kbuild?

Let generate_testapi.py be a script in my Linux kernel module's source tree, that ingests mymod_test.h and generates a interface source file toward userland (ioctl, debugfs, you name it), and lets name this $(obj)/mymod_test_interfaces.gen.c. In the…
datenwolf
  • 159,371
  • 13
  • 185
  • 298