linux-kernel

Is kmalloc allocation not virtually contiguous?

拜拜、爱过 提交于 2021-02-04 06:08:26
问题 I found that kmalloc returns physically and virtually contiguous memory. I wrote some code to observe the behavior, but only the physical memory seems to be contiguous and not the virtual. Am I making any mistake? #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/moduleparam.h> MODULE_LICENSE("GPL"); static char *ptr; int alloc_size = 1024; module_param(alloc_size, int, 0); static int test_hello_init(void) { ptr = kmalloc(alloc_size,GFP_ATOMIC); if(

Linux: writes are split into 512K chunks

為{幸葍}努か 提交于 2021-02-04 05:50:27
问题 I have a user-space application that generates big SCSI writes (details below). However, when I'm looking at the SCSI commands that reach the SCSI target (i.e. the storage, connected by the FC) something is splitting these writes into 512K chunks. The application basically does 1M-sized direct writes directly into the device: fd = open("/dev/sdab", ..|O_DIRECT); write(fd, ..., 1024 * 1024); This code causes two SCSI WRITEs to be sent, 512K each. However, if I issue a direct SCSI command,

Linux: writes are split into 512K chunks

与世无争的帅哥 提交于 2021-02-04 05:50:20
问题 I have a user-space application that generates big SCSI writes (details below). However, when I'm looking at the SCSI commands that reach the SCSI target (i.e. the storage, connected by the FC) something is splitting these writes into 512K chunks. The application basically does 1M-sized direct writes directly into the device: fd = open("/dev/sdab", ..|O_DIRECT); write(fd, ..., 1024 * 1024); This code causes two SCSI WRITEs to be sent, 512K each. However, if I issue a direct SCSI command,

verifying where 'kworker/n:n' (in ps -aux) is invoked from

三世轮回 提交于 2021-01-29 19:15:49
问题 In the result of 'ps -aux', I couldn't find how to verify that 'kworker/...' are created from and what module/functions are related to it. Please let me know how I find out kworkers are from with pid or else. I've try to check files in /proc, nothing is shown about this. $ ps -aux | grep kworker root 15 0.0 0.0 0 0 ? S Aug12 0:00 [kworker/1:0] root 16 0.0 0.0 0 0 ? S< Aug12 0:00 [kworker/1:0H] root 85 0.0 0.0 0 0 ? S< Aug12 0:09 [kworker/0:1H] root 3562 0.0 0.0 0 0 ? S< Aug12 0:00 [kworker/0

Making Kernel Module and registering it as pci device driver and network device driver and accessing the module's buffer using ioctl. Possible?

本小妞迷上赌 提交于 2021-01-29 17:16:50
问题 I like to make a kernel module. And inside it I like to register it as pci and network device driver. And using ioctle from user space to access the module's buffer(in pci and network driver) and getting buffer. The buffer contains packets received in interrupt handler when packet arrives in my kernel module/device driver and the buffer is global in the module. Means it will not be inside interrupt handler for receiving packets. and in ioctl function implementation inside device driver just

cgroups blkio subsystem is not counting the block write byte count properly for conatiner applications

坚强是说给别人听的谎言 提交于 2021-01-29 14:33:04
问题 I am working on the linux kernel base 3.14 version and i have enabled the cgroup and blkio subsystem on it for checking the write byte count of the block device from the container and host applications. But, I have problems in getting the written bytes from the cgroup blkio throttling function for the container application. It works for the main hierarchy (e.g. /sys/fs/cgroup/blkio/blkio.throttle.io_service_bytes) , but not for the deeper ones (e.g. /sys/fs/cgroup/blkio/lxc/web (container

Trying to disable paging through cr0 register

三世轮回 提交于 2021-01-29 11:11:54
问题 I'm trying to disable paging completely with an LKM (don't ask me why I'm just experimenting). I've tried just changing the value directly with the LKM. void disable_paging(void) { asm("movq %cr0, %rax\n\t" "movq $0xFFFFFFFEFFFFFFFF, %rbx\n\t" "and %rbx, %rax\n\t" "movq %rax, %cr0\n\t"); } Well the expected result would be the bit being flipped. The actual result is a segfault. 回答1: TL:DR: This can't work, but your attempt didn't disable paging because you cleared bit 32 instead of bit 31.

LiME Kernel Module Cross Compilation Fails

杀马特。学长 韩版系。学妹 提交于 2021-01-29 11:11:22
问题 I'm trying to cross-compile the LiME Kernel Module for the android-goldfish-3.10-n-dev ( commit: 3a3b199582a68ba0688a099147738d6c99f3282d ) Linux Kernel version with the following Makefile: obj-m := lime.o lime-objs := tcp.o disk.o main.o KDIR_GOLD := /path/to/goldfish PWD := $(shell pwd) CCPATH :=/path/to/x86_64-linux-android-4.9/bin default: # cross-compile for Android emulator $(MAKE) ARCH=x86_64 CROSS_COMPILE=$(CCPATH)/x86_64-linux-android- -C $(KDIR_GOLD) M="$(PWD)" modules $(CCPATH)/x86

HOW TO FORCEFULLY DISABLE intel_pstate? intel_pstate is enabled on reboot even with intel_pstate=disable option in grub

走远了吗. 提交于 2021-01-29 10:20:55
问题 I am trying to use cpu-frequency scaling to set cpu frequency. In my system, only powersave , performance frequency-scaling-governor supported. It was explained in other document, by default, intel_pstate is enabled and it only supports powersave , performance frequency-scaling-governor and solution is disable intel_pstate. So I tried to disable as below sudo nano /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="intel_pstate=disable" sudo update-grub on reboot, intel_pstate is enabled. so ,

Where does “Freeing unused kernel memory” come from?

拥有回忆 提交于 2021-01-29 09:45:56
问题 I often see Freeing unused kernel memory: xxxK (......) from dmesg , but I can never find this log from kernel source code with the help of grep/rg. Where does it come from? 回答1: That line of text does not exist as a single, complete string, hence your failure to grep it. This all gets rolling when free_initmem() in init/main.c calls free_initmem_default() . The line in question originates from free_initmem_default() in include/linux/mm.h : /* * Default method to free all the __init memory