Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/tools/sched_ext/include/scx/bpf_arena_common.h
29271 views
1
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
2
/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */
3
#pragma once
4
5
#ifndef arena_container_of
6
#define arena_container_of(ptr, type, member) \
7
({ \
8
void __arena *__mptr = (void __arena *)(ptr); \
9
((type *)(__mptr - offsetof(type, member))); \
10
})
11
#endif
12
13
/* Provide the definition of PAGE_SIZE. */
14
#include <sys/user.h>
15
16
#define __arena
17
#define __arg_arena
18
#define cast_kern(ptr) /* nop for user space */
19
#define cast_user(ptr) /* nop for user space */
20
char __attribute__((weak)) arena[1];
21
22
#ifndef offsetof
23
#define offsetof(type, member) ((unsigned long)&((type *)0)->member)
24
#endif
25
26
static inline void __arena* bpf_arena_alloc_pages(void *map, void *addr, __u32 page_cnt,
27
int node_id, __u64 flags)
28
{
29
return NULL;
30
}
31
static inline void bpf_arena_free_pages(void *map, void __arena *ptr, __u32 page_cnt)
32
{
33
}
34
35