ANDROID: mm: Add vendor hook in swapon()

This patch add a vendor hook in swapon() for changing swap
info flags to meet the capability of certain swap devices.

Bug: 368512254
Change-Id: I009f039179db3d4ac23039c7ddd09fa852f3729f
Signed-off-by: Chinwen Chang <chinwen.chang@mediatek.com>
This commit is contained in:
Chinwen Chang
2025-04-09 15:46:19 +08:00
committed by Kalesh Singh
parent 0258c527fb
commit 2d4f0c51e1
3 changed files with 7 additions and 0 deletions
+1
View File
@@ -449,6 +449,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmscan_kswapd_wake);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_vmscan_kswapd_done);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_customize_alloc_gfp);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_kcompactd_cpu_online);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_adjust_swap_info_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_direct_reclaim_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_direct_reclaim_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_read_fault);
+3
View File
@@ -399,6 +399,9 @@ DECLARE_HOOK(android_vh_customize_alloc_gfp,
DECLARE_HOOK(android_vh_mm_kcompactd_cpu_online,
TP_PROTO(int cpu),
TP_ARGS(cpu));
DECLARE_HOOK(android_vh_adjust_swap_info_flags,
TP_PROTO(unsigned long *flags),
TP_ARGS(flags));
DECLARE_HOOK(android_rvh_alloc_pages_reclaim_start,
TP_PROTO(gfp_t gfp_mask, int order, int *alloc_flags),
TP_ARGS(gfp_mask, order, alloc_flags));
+3
View File
@@ -50,6 +50,7 @@
#include "internal.h"
#include "swap.h"
#include <trace/hooks/bl_hib.h>
#include <trace/hooks/mm.h>
static bool swap_count_continued(struct swap_info_struct *, pgoff_t,
unsigned char);
@@ -3500,6 +3501,8 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
if (si->bdev && bdev_synchronous(si->bdev))
si->flags |= SWP_SYNCHRONOUS_IO;
trace_android_vh_adjust_swap_info_flags(&si->flags);
if (si->bdev && !hibernation_swap && bdev_nonrot(si->bdev)) {
si->flags |= SWP_SOLIDSTATE;