ANDROID: mm: add vendor hook in zs_shrinker

Add vendor hook to adjust zs_shrinker frequency.

Bug: 351175506
Change-Id: I1bcdf2df605a08b57546e5e3e3303cb2f10cb043
Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
Sooyong Suk
2024-08-05 17:59:11 +09:00
committed by Treehugger Robot
parent b02669867b
commit 1808855fbf
3 changed files with 15 additions and 0 deletions
+2
View File
@@ -347,3 +347,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_fault_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_fault_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_heap_buffer_alloc_start);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dma_heap_buffer_alloc_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zs_shrinker_adjust);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_zs_shrinker_bypass);
+6
View File
@@ -244,6 +244,12 @@ DECLARE_HOOK(android_vh_filemap_fault_start,
DECLARE_HOOK(android_vh_filemap_fault_end,
TP_PROTO(struct file *file, pgoff_t pgoff),
TP_ARGS(file, pgoff));
DECLARE_HOOK(android_vh_zs_shrinker_adjust,
TP_PROTO(unsigned long *pages_to_free),
TP_ARGS(pages_to_free));
DECLARE_HOOK(android_vh_zs_shrinker_bypass,
TP_PROTO(bool *bypass),
TP_ARGS(bypass));
#endif /* _TRACE_HOOK_MM_H */
/* This part must be outside protection */
+7
View File
@@ -65,6 +65,7 @@
#include <linux/pagemap.h>
#include <linux/fs.h>
#include <linux/local_lock.h>
#include <trace/hooks/mm.h>
#define ZSPAGE_MAGIC 0x58
@@ -2056,6 +2057,11 @@ static unsigned long zs_shrinker_count(struct shrinker *shrinker,
struct size_class *class;
unsigned long pages_to_free = 0;
struct zs_pool *pool = shrinker->private_data;
bool bypass = false;
trace_android_vh_zs_shrinker_bypass(&bypass);
if (bypass)
return 0;
for (i = ZS_SIZE_CLASSES - 1; i >= 0; i--) {
class = pool->size_class[i];
@@ -2064,6 +2070,7 @@ static unsigned long zs_shrinker_count(struct shrinker *shrinker,
pages_to_free += zs_can_compact(class);
}
trace_android_vh_zs_shrinker_adjust(&pages_to_free);
return pages_to_free;
}