Questions tagged [virtual-memory]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
21 views

Is it possible to read page table in Linux with unprivileged mode?

this is my very first question in Unix & Linux, I'm currently learning about virtual memory. I am appreciating this awesome paper drammer (CCS'16). Where it fools the buddy allocator to allocate a ...
Y.H.Qian's user avatar
1 vote
1 answer
34 views

How to compile Linux for x86_64 with page size other than 4096?

I was trying to compile x64 Linux kernel with higher page size than 4096. It is needed to mount filesystems with high block size via VFS. On other architectures I could select the page size using ...
melonfsck's user avatar
  • 143
0 votes
0 answers
18 views

Difference in memory page fault for sequential access vs random access?

Suppose we have a range of memory values that are mapped (but not loaded), and we would like to access them. Is there any kind of optimizations the kernel does that would make the sequential access ...
Ymi's user avatar
  • 101
3 votes
1 answer
80 views

How is 4kB RSS possible in Linux 4.x?

I have been the dev/maintainer of an open source IRC bot since the late 90s. The goal was always to make it as versatile & useful as possible in a small memory footprint. During the 2000s I also ...
Alonda's user avatar
  • 131
0 votes
0 answers
18 views

How to manually map a virtual address to a page in Linux kernel?

I am working on an embedded Linux system (kernel-5.10.24), and i am trying to do a test of mapping kernel memory. This test does similar things as vmalloc() does. It gets a virtual memory address and ...
wangt13's user avatar
  • 429
0 votes
2 answers
141 views

Linux disable RAM Cache

I'm running Debian stable with kernel 6.5 on an ARM M1 MacBook Air. The biggest issue is that RAM and VRAM are unified, and there is no particular way to even check how much of the used RAM is VRAM (...
Nick Bailuc's user avatar
1 vote
0 answers
112 views

Process memory layout - difference between heap, data and mmap areas

I see in the web many conflicting or unclear descriptions of the memory layout of a Linux process. Usually the common diagram looks like: And a common description would say that: The data segment ...
aviro's user avatar
  • 5,552
0 votes
0 answers
21 views

Extended virtual harddisk in CentOS VM, not showng in df -h even after applying resize operation in GParted

I've extended the virtual drive of my CentOS VM (Windows Hyper-V manager) from 25GB to 40GB. Also used GParted to resize the existing /dev/sda2 to use the entire newly unallocated 15GB space (clicked ...
Sss's user avatar
  • 1
0 votes
0 answers
30 views

How to check which physical address belongs to which NUMA node?

I have some physical addresses, which I want to check which NUMA node it belongs to. I've been searching, and I've found some ways to check the NUMA node with virtual address (e.g., move_pages), but ...
Michael Jaemin Kim's user avatar
1 vote
2 answers
141 views

System calls involved in stack and heap allocation

In the process address space, there is the stack and the heap. When a function is called, or even when a local variable is declared, it uses the stack; the kernel must assign physical address and ...
Dev Jain's user avatar
2 votes
1 answer
220 views

How can I locate the stacks of child tasks (threads) using /proc/<pid>/maps?

PURPOSE: I am theorising as to how one would go about creating a pointer scanner in a Linux environment. DISCLAIMER: My findings have been tested on Debian Bookworm (current stable) and a Gentoo ...
vykt's user avatar
  • 21
0 votes
1 answer
84 views

How to measure mmap I/O latency?

I have an application which appears to be slowing/blocking at the same time there's a lot of disk I/O going on, so I suspect it's I/O operations within the application which are blocking. I can't ...
phemmer's user avatar
  • 71.9k
4 votes
1 answer
345 views

Why does my system heavily use swap when there are 86 GB of RAM still usable?

This is not so much a performance problem as it is a desire to understand what is happening and how it works. I have a system with lots of resources, including 128 GB of RAM. What I have discovered (...
Freedom_Ben's user avatar
  • 4,494
0 votes
1 answer
253 views

Heap memory allocation in Linux

I'm confused about whether the memory allocated by Linux when a process requests 'x' amount of heap is actually contiguous physically or not? Here's my understanding till now: The unit of memory ...
Vishal Sharma's user avatar
1 vote
0 answers
317 views

Linux HugeTLB: What is the advantage of the filesystem approach?

Moved Post Notice I just moved this question (with slight modifications) from a StackOverflow question (which I have deleted, since cross-posting is strongly discouraged), which has not been answered ...
Lukas Barth's user avatar
5 votes
2 answers
1k views

Who decides the physical address for a particular virtual address, kernel or MMU?

I am trying to understand how the physical addresses are allocated when running an OS. My question is when the kernel allocates some memory (lets say using kmalloc), who decides what physical memory ...
sammy17's user avatar
  • 75
0 votes
0 answers
79 views

Will the implementation of mremap free physical pages?

Recently, I am reading the memory management part of linux kernel code (the version I am reading is 4.10). I find that the implementation of mremap is strange. In short, sys_mremap() will call ...
huangjl's user avatar
0 votes
0 answers
160 views

Use only 2MB pages

I would like to use a linux version in which only 2MB pages are used (i.e., no libhugetlbfs and transparent huge pages). From other similar questions (e.g., Linux use huge pages only), I understood ...
rrpp1045's user avatar
0 votes
1 answer
72 views

Do page tables used to store kernel stack pointer when context switch happen in kernel mode of the process?

I have two questions; Suppose a user space application/process is running in kernel mode. I understand if a context switch is happened now, the kernel stack pointer of that process is stored in the ...
Franc's user avatar
  • 289
1 vote
0 answers
72 views

Is it possible to maintain performance of "preferred" applications when certain resources are limited?

I work as a web developer, and due to the tools I generally have running (not to mention web browsers) I generally have high RAM usage at all times. Most of the time, my system handles this just fine. ...
Daniel Littlewood's user avatar
1 vote
1 answer
206 views

How to create a private swap file for a specific process or cgroup in Linux?

I'm currently attempting to generate a swap file in Linux that is exclusive to a particular process or cgroup. After going through the LWN article which discusses the patches that enable this ...
Elior Gigi's user avatar
0 votes
0 answers
149 views

How does memory mapping File works in OS?

In OS concepts, it states that: memory mapping a file, allows a part of the virtual address space to be logically associated with the file my concept is: Usually when a process reads a file on disk ...
Abhijit Dey's user avatar
0 votes
1 answer
2k views

Trying to understand memory-mapping with C++ in Linux environment

I've been tasked at worked to explore memory mapping to see if we can utilize it. I'm trying to wrap my head around the concept and how to write the code. I've been trying out the code in the ...
Many Questions's user avatar
0 votes
1 answer
41 views

How CPU knows/enforcing segment/page access violation?

x86 IA-32 In my understanding accessing memory from user space program does not involve operating system.. Otherwise it would be slow. So if paging enabled or not CPU should know somehow that this ...
v.doro2's user avatar
0 votes
0 answers
117 views

Exam question - 64-Bit Virtual memory - Proper address for pointer variable

In a mock exam there is the following question: Which of the following addresses is a proper memory address for a pointer variable on an x86_64 processor? 0x7ffffff3328 0x0 0x8043844 0x555555ab3b ...
M. Peterson's user avatar
0 votes
1 answer
336 views

How do I open a mmap of size of a TB

I need to open a huge memory map. The file is one terabyte. I however am getting an errno: ENOMEM 12 Cannot allocate memory. I don't get what is holding me up. Requesting the RLIMIT_AS results in the ...
Tarick Welling's user avatar
0 votes
1 answer
220 views

Why does hibernation require a swap space to be roughly equal in size to total system RAM when we have file mapping and demand paging?

It is my understanding that pages in memory containing things like program text and shared libraries that have associated real world files will actually map to that associated file instead of swap (i....
qmild's user avatar
  • 1
1 vote
1 answer
48 views

How to Get Total Count of Non-Swappable Pages in RAM?

I am trying to debug some ML code that requires pinned physical memory, and in order to help with this, I would like to figure out how much of physical RAM consists of pages that can't be swapped out (...
Agent 008's user avatar
1 vote
1 answer
349 views

mapping device file benefits

I wanted to ask what are the benefits of mapping a device file using mmap. There is a driver which implements file operations API for that device file. I'm asking since device files are not stored on ...
hutcruchi's user avatar
  • 339
0 votes
0 answers
168 views

How do you map a pointer location to /proc/self/{map,mem}?

I am trying to write a light weight test to determine if sensitive parameters are getting zero'd in active memory after use. Here is what I thought would work: Get the pointer location of the ...
Liam Kelly's user avatar
0 votes
0 answers
1k views

Creating a "virtual/ fake" usb drive on linux filesystem

Reference post: Create virtual USB drive Problem statement: I would like to create/ convert and area on my (Ubuntu 20.04) filesystem such that application's think a USB is connected to my machine, and ...
LaBeaux's user avatar
0 votes
1 answer
672 views

How to dump the stack and heap of a running application to determine if zeroization is occuring?

I am trying to ensure that after the use of sensitive parameters, a program zero-es them from all active memory (stack and heap). The simple test I was hoping to perform was to dump the active memory ...
Liam Kelly's user avatar
0 votes
1 answer
145 views

.got.plt not loaded into memory

I have an aarch64 process (cat) running on an Android (8). I notice this section in /proc/<PID/maps: 746f308000-746f3de000 r-xp 00000000 103:00 5402 /system/lib64/libc++.so 746f3de000-...
Daniel Walker's user avatar
1 vote
1 answer
213 views

LOAD segment not loaded

While examining the /proc/<PID>/maps file for an aarch64 process running on an Android (8), I notice this section: 726048e000-7260564000 r-xp 00000000 103:00 5402 /system/lib64/libc++.so ...
Daniel Walker's user avatar
1 vote
0 answers
30 views

What happens if a running executable can no longer load its code/data pages?

This is under the assumption that the binary is large enough that not all pages were loaded into memory at the start of execution. What would happen if the underlying file system suddenly disappears (...
SUPERCILEX's user avatar
3 votes
1 answer
1k views

Can a Linux Swap Partition Be Too Big?

Can a Linux swap partition be too big? I'm pretty certain the answer is, "no" but I haven't found any resources on-point, so thought I'd ask. In contrast, the main Windows swap file, ...
ebsf's user avatar
  • 301
3 votes
1 answer
136 views

.text section not readable

I was looking at the /proc/<pid>/maps file for an aarch64 process running on an Android (10). This section caught my interest: 72582d2000-72582f6000 --xp 00012000 07:20 93 /apex/com....
Daniel Walker's user avatar
0 votes
1 answer
710 views

How does MMU find out what address it should translate?

When we try to read/write some data to/from a specific address we must know where the first page directory is stored and the address we want translate. As for the first page directory (as far as I ...
k1r1t0's user avatar
  • 133
-1 votes
1 answer
590 views

How to access virtual address via terminal in Ubuntu?

i'm trying to read & write to register by using the busybox devmem command. I printed its base address from the driver's source code and received the following address: 0xffffff800bdd0000 I ...
jetson user's user avatar
0 votes
0 answers
44 views

In Linux what is the difference between swapping and paging? [duplicate]

I am trying to figure out what the difference is between paging and swapping on linux. My question mainly relates to the output vmstat gives you. Example: $ vmstat -s 8022500 K total memory ...
Lasse Jacobs's user avatar
0 votes
0 answers
183 views

Addressing in linux

I'm trying to understand addressing and memory. the book Embedded Linux primer says Notice that the process called hello thinks it is executing somewhere in high RAM just above the 256MB boundary (...
soul z's user avatar
  • 1
0 votes
0 answers
30 views

My swap is getting full and I don't know what's happening

RANGE SIZE STATE REMOVABLE BLOCK 0x0000000000000000-0x0000000087ffffff 2.1G online yes 0-16 0x0000000100000000-0x0000000477ffffff 13.9G online yes 32-...
Lerian Acosenossa's user avatar
1 vote
1 answer
150 views

Linux memory allocation for user's process (buddy allocator)

I'm studying memory allocation in Linux and I have a question about the buddy allocator. Reading the documentation available on kernel.org I've learn that the buddy allocator is responsible for the ...
Bender's user avatar
  • 121
2 votes
0 answers
53 views

Overlapping address ranges in /proc/.../maps

On some Android devices (possibly only on Android 10 and newer), looking at /proc/self/maps, I observed entries like the following two lines: 79cfd4d000-79cfff5000 --xp 0012e000 fd:00 286 /apex/com....
David Scherfgen's user avatar
1 vote
0 answers
47 views

Is the stack of a forked process shared with its parent? [duplicate]

Is the stack of a forked process shared with its parent? If so, does this happen via shared copy-on-write pages?
HappyFace's user avatar
  • 1,612
3 votes
0 answers
58 views

How do I undo copying a file that is ended up in cache?

I have copied a large file to USB drive. The file appeared to be copied almost instantly, but copying operation stalled at the very end. /proc/meminfo is showing large, gigabyte Dirty: entry which is ...
Vi.'s user avatar
  • 5,698
0 votes
1 answer
142 views

Is vmalloc() allocate bytes of memory which is virtually contiguous maps to memory area from different physical pages?

vmalloc(size) allocates a memory of size long which is virtually contiguous but the physical mapping would not be contiguous. Does that mean the the virtually allocated size long memory actually lies ...
Franc's user avatar
  • 289
4 votes
1 answer
4k views

Cgroup and process memory statistics mismatch

I am trying to set up some monitoring to see when a service is using too much memory. The memory usage can be read from two places: the /proc/<pid>/status for the pid, or the /sys/fs/cgroup/<...
Jan Hudec's user avatar
  • 651
1 vote
2 answers
263 views

Spike in number of page faults with make -j`nproc`

I am running a benchmark to figure out the number of jobs I should allow GNU Make to use in order to have optimal compile time. To do so, I am compiling Glibc with make -j<N> with N an integer ...
Abdelhakim AKODADI's user avatar
0 votes
1 answer
1k views

Dumping virtual memory addresses of an executable from /proc/pid/maps

I want to dump the virtual memory addresses of a running executable. This is the command I'm running: ./executable & cat /proc/$(pidof executable)/maps > maps.dump, and this is the error I get: ...
Farzam's user avatar
  • 1

1
2 3 4 5
9