Merge "Remove usage of BPF_FD_JUST_USE_INT in favor of unique_fd" into main am: 0aeff477af am: 8e4290acac
Original change: https://android-review.googlesource.com/c/platform/system/memory/lmkd/+/3133997 Change-Id: I1d6c3e4db93f4b5c21548fecabdd193a5b3e2d61 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
540ed179a7
11
lmkd.cpp
11
lmkd.cpp
|
|
@ -40,6 +40,8 @@
|
|||
#include <shared_mutex>
|
||||
#include <vector>
|
||||
|
||||
#include <BpfSyscallWrappers.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <bpf/KernelUtils.h>
|
||||
#include <bpf/WaitForProgsLoaded.h>
|
||||
#include <cutils/properties.h>
|
||||
|
|
@ -60,9 +62,6 @@
|
|||
#include "statslog.h"
|
||||
#include "watchdog.h"
|
||||
|
||||
#define BPF_FD_JUST_USE_INT
|
||||
#include "BpfSyscallWrappers.h"
|
||||
|
||||
/*
|
||||
* Define LMKD_TRACE_KILLS to record lmkd kills in kernel traces
|
||||
* to profile and correlate with OOM kills
|
||||
|
|
@ -2116,12 +2115,12 @@ static bool meminfo_parse_line(char *line, union meminfo *mi) {
|
|||
}
|
||||
|
||||
static int64_t read_gpu_total_kb() {
|
||||
static int fd = android::bpf::bpfFdGet(
|
||||
"/sys/fs/bpf/map_gpuMem_gpu_mem_total_map", BPF_F_RDONLY);
|
||||
static android::base::unique_fd fd(
|
||||
android::bpf::mapRetrieveRO("/sys/fs/bpf/map_gpuMem_gpu_mem_total_map"));
|
||||
static constexpr uint64_t kBpfKeyGpuTotalUsage = 0;
|
||||
uint64_t value;
|
||||
|
||||
if (fd < 0) {
|
||||
if (!fd.ok()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue