1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright 2006 Andi Kleen, SUSE Labs.
4 *
5 * Fast user context implementation of getcpu()
6 */
7
8#include <linux/kernel.h>
9#include <linux/getcpu.h>
10#include <asm/segment.h>
11#include <vdso/processor.h>
12
13notrace long
14__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *unused)
15{
16 vdso_read_cpunode(cpu, node);
17
18 return 0;
19}
20
21long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
22 __attribute__((weak, alias("__vdso_getcpu")));
23

source code of linux/arch/x86/entry/vdso/vgetcpu.c