Path: blob/master/tools/sched_ext/include/scx/bpf_arena_common.h
29271 views
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */1/* Copyright (c) 2024 Meta Platforms, Inc. and affiliates. */2#pragma once34#ifndef arena_container_of5#define arena_container_of(ptr, type, member) \6({ \7void __arena *__mptr = (void __arena *)(ptr); \8((type *)(__mptr - offsetof(type, member))); \9})10#endif1112/* Provide the definition of PAGE_SIZE. */13#include <sys/user.h>1415#define __arena16#define __arg_arena17#define cast_kern(ptr) /* nop for user space */18#define cast_user(ptr) /* nop for user space */19char __attribute__((weak)) arena[1];2021#ifndef offsetof22#define offsetof(type, member) ((unsigned long)&((type *)0)->member)23#endif2425static inline void __arena* bpf_arena_alloc_pages(void *map, void *addr, __u32 page_cnt,26int node_id, __u64 flags)27{28return NULL;29}30static inline void bpf_arena_free_pages(void *map, void __arena *ptr, __u32 page_cnt)31{32}333435