smp

Pin processor CPU Isolation on Windows

↘锁芯ラ 提交于 2020-12-08 07:19:19
问题 In linux where I work mostly, we use a technique called CPU isolation, that effectively locks a process on to a processor and also prevents the processor from running anything else. Our kernel guys did some magic to handle the interrupts. In windows the closest thing I found is an affinity concept which appears to bind a process/thread to a processor. But it makes no guarantee that the processor is ONLY running that process/thread meaning there can still be context switch and other jitter. Is

Perf event for sending reschedule interrupt?

雨燕双飞 提交于 2020-03-21 05:37:54
问题 When a process wakes another process on the same core, a sched:sched_wakeup event is generated with both PIDs. This is great for finding relationships between processes. When a process wakes another process on a different core, the second core generates an irq_vectors:reschedule_entry event on whichever process is unlucky enough to catch the IPI, followed by a sched:sched_wakeup event from that victim process. What I can't find is the original process on the first core that does the waking.

how is a memory barrier in linux kernel is used

和自甴很熟 提交于 2020-01-01 05:17:07
问题 There is an illustration in kernel source Documentation/memory-barriers.txt, like this: CPU 1 CPU 2 ======================= ======================= { B = 7; X = 9; Y = 8; C = &Y } STORE A = 1 STORE B = 2 <write barrier> STORE C = &B LOAD X STORE D = 4 LOAD C (gets &B) LOAD *C (reads B) Without intervention, CPU 2 may perceive the events on CPU 1 in some effectively random order, despite the write barrier issued by CPU 1: +-------+ : : : : | | +------+ +-------+ | Sequence of update | |------>

How could I know which core a process is running on?

孤街醉人 提交于 2019-12-23 12:55:39
问题 I am currently working on a project about setting process to one core in linux environment. I use sched_setaffinity to do this job and I wonder whether there are some functions provided by linux to get which core the process is running on. I use top command and find it could get this info using j option. So i am sure there are some ways to get this info in user space. 回答1: You probably want sched_getcpu() . If you are running an older version of glibc, you can read the 39th field of /proc/

What limits scaling in this simple OpenMP program?

元气小坏坏 提交于 2019-12-18 17:01:11
问题 I'm trying to understand limits to parallelization on a 48-core system (4xAMD Opteron 6348, 2.8 Ghz, 12 cores per CPU). I wrote this tiny OpenMP code to test the speedup in what I thought would be the best possible situation (the task is embarrassingly parallel): // Compile with: gcc scaling.c -std=c99 -fopenmp -O3 #include <stdio.h> #include <stdint.h> int main(){ const uint64_t umin=1; const uint64_t umax=10000000000LL; double sum=0.; #pragma omp parallel for reduction(+:sum) for(uint64_t u

How are percpu pointers implemented in the Linux kernel?

倖福魔咒の 提交于 2019-12-18 11:50:01
问题 On multiprocessor, each core can have its own variables. I thought they are different variables in different addresses, although they are in same process and have the same name. But I am wondering, how does the kernel implement this? Does it dispense a piece of memory to deposit all the percpu pointers, and every time it redirects the pointer to certain address with shift or something? 回答1: Normal global variables are not per CPU. Automatic variables are on the stack, and different CPUs use

How can I get the CPU core number from within a user-space app (Linux, C)?

China☆狼群 提交于 2019-12-17 09:40:18
问题 Presumably there is a library or simple asm blob that can get me the number of the current CPU that I am executing on. 回答1: Use sched_getcpu to determine the CPU on which the calling thread is running. See man getcpu (the system call) and man sched_getcpu (a library wrapper). However, note what it says: The information placed in cpu is only guaranteed to be current at the time of the call: unless the CPU affinity has been fixed using sched_setaffinity(2), the kernel might change the CPU at

multi-CPU, multi-core and hyper-thread

帅比萌擦擦* 提交于 2019-12-17 06:23:12
问题 Could anyone recommend some documents to me to illustrate the differences between multi-CPU, multi-core, and hyper-thread? I am always confused about these differences, and about the pros/cons of each architecture in different scenarios. EDIT: here is my current understanding after learning online and learning from others' comments; could anyone review comment please? I think hyper-thread is the most inferior technology among them, but cheap. Its main idea is duplicate registers to save

multi-CPU, multi-core and hyper-thread

假装没事ソ 提交于 2019-12-17 06:23:03
问题 Could anyone recommend some documents to me to illustrate the differences between multi-CPU, multi-core, and hyper-thread? I am always confused about these differences, and about the pros/cons of each architecture in different scenarios. EDIT: here is my current understanding after learning online and learning from others' comments; could anyone review comment please? I think hyper-thread is the most inferior technology among them, but cheap. Its main idea is duplicate registers to save

Linux Kernel: Spinlock SMP: Why there is a preempt_disable() in spin_lock_irq SMP version?

ぃ、小莉子 提交于 2019-12-14 00:30:38
问题 The original code in Linux kernel is: static inline void __raw_spin_lock_irq(raw_spinlock_t *lock) { local_irq_disable(); preempt_disable(); spin_acquire(&lock->dep_map, 0, 0, _RET_IP_); LOCK_CONTENDED(lock, do_raw_spin_trylock, do_raw_spin_lock); } I think there is no execution path can preempt current path after local IRQ is disabled. Because all common hard IRQs are disabled, there should be no softirq occur and also no tick to kick schedule wheel. I think current path is safe. So why