ANDROID: vendor hook to control bh_lru and lru_cache_disable
Add vendor hook for bh_lru and lru_cache_disable
Bug: 238728493
Signed-off-by: Minchan Kim <minchan@google.com>
Change-Id: I81bfad317cf6e8633186ebb3238644306d7a102d
Signed-off-by: Richard Chang <richardycc@google.com>
(cherry picked from commit 74e2ea264cd1895c493b9008b62bfea98dacf3f6)
diff --git a/fs/buffer.c b/fs/buffer.c
index 6f53160..50ef77e 100644
--- a/fs/buffer.c
+++ b/fs/buffer.c
@@ -51,6 +51,8 @@
#include "internal.h"
+#include <trace/hooks/buffer.h>
+
static int fsync_buffers_list(spinlock_t *lock, struct list_head *list);
static int submit_bh_wbc(int op, int op_flags, struct buffer_head *bh,
enum rw_hint hint, struct writeback_control *wbc);
@@ -1233,6 +1235,7 @@ static void bh_lru_install(struct buffer_head *bh)
struct buffer_head *evictee = bh;
struct bh_lru *b;
int i;
+ bool skip = false;
check_irqs_on();
bh_lru_lock();
@@ -1248,6 +1251,12 @@ static void bh_lru_install(struct buffer_head *bh)
return;
}
+ trace_android_vh_bh_lru_install(bh->b_page, &skip);
+ if (skip) {
+ bh_lru_unlock();
+ return;
+ }
+
b = this_cpu_ptr(&bh_lrus);
for (i = 0; i < BH_LRU_SIZE; i++) {
swap(evictee, b->bhs[i]);