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 <shared_mutex>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <BpfSyscallWrappers.h>
|
||||||
|
#include <android-base/unique_fd.h>
|
||||||
#include <bpf/KernelUtils.h>
|
#include <bpf/KernelUtils.h>
|
||||||
#include <bpf/WaitForProgsLoaded.h>
|
#include <bpf/WaitForProgsLoaded.h>
|
||||||
#include <cutils/properties.h>
|
#include <cutils/properties.h>
|
||||||
|
|
@ -60,9 +62,6 @@
|
||||||
#include "statslog.h"
|
#include "statslog.h"
|
||||||
#include "watchdog.h"
|
#include "watchdog.h"
|
||||||
|
|
||||||
#define BPF_FD_JUST_USE_INT
|
|
||||||
#include "BpfSyscallWrappers.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Define LMKD_TRACE_KILLS to record lmkd kills in kernel traces
|
* Define LMKD_TRACE_KILLS to record lmkd kills in kernel traces
|
||||||
* to profile and correlate with OOM kills
|
* 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 int64_t read_gpu_total_kb() {
|
||||||
static int fd = android::bpf::bpfFdGet(
|
static android::base::unique_fd fd(
|
||||||
"/sys/fs/bpf/map_gpuMem_gpu_mem_total_map", BPF_F_RDONLY);
|
android::bpf::mapRetrieveRO("/sys/fs/bpf/map_gpuMem_gpu_mem_total_map"));
|
||||||
static constexpr uint64_t kBpfKeyGpuTotalUsage = 0;
|
static constexpr uint64_t kBpfKeyGpuTotalUsage = 0;
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
|
|
||||||
if (fd < 0) {
|
if (!fd.ok()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue