0

My computer has the following specifications

  • 2 Intel CPU x86_64
  • Total 8GB memory (4GB per CPU)
  • O/S is Rocky Linux 9

I want to reserve 1GB of memory per CPU using the memmap parameter in grub. I checked dmesg and /proc/meminfo and even used numaclt -H. But I couldn't find the physical address of the memory for each CPU.

How can I get physical addresses of local memory of each CPU?

2
  • 2
    wait, which intel CPUs are we talking about? Your average Intel CPU doesn't have "per CPU memory"; it's not NUMA on that hardware level; multiple cores share the same memory controller. Or is this some rather old dual-socket server mainboard, considering the miniscule amount of RAM? Your specs are totally insufficiently detailed to help you! Commented May 16, 2023 at 8:09
  • 1
    reserving physical memory addresses "per CPU" also makes no sense at all. This is really mysteriously nebolous – I think your question really only becomes answerable once you start describing 1. your actual hardware including mainboard, concrete CPU model & configuration, 2. explain what it is that you want to achieve by reserving that memory; what kind of addresses you're thinking you'll be dealing with. I think you might be abusing the term "physical address" here, but I'm really not sure, because this all seems so confusing and confused. Commented May 16, 2023 at 8:14

1 Answer 1

2

If your intention is to run an application on a specific CPU core, allocate specific set of resources (memory) to it, you can do something like:

Taskset

#launch google-chrome on CPU core 0
taskset 0x1 google-chrome

Cgroups

# Create a cgroup
mkdir /sys/fs/cgroup/memory/my_cgroup

# Add the process to it
echo $PID > /sys/fs/cgroup/memory/my_cgroup/cgroup.procs

# Set the limit to 100MB
echo $((100 * 1024 * 1024)) > /sys/fs/cgroup/memory/my_cgroup/memory.limit_in_bytes

It's always a good idea to interact with hardware via OS abstractions, unless we know exactly what we're doing/undoing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .