mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2025-07-07 01:45:18 +02:00
ANDROID: memcg: add vendor hook to use vm_swappiness
Add vendor hook to use system-wide vm_swappiness. Refered to https://android-review.googlesource.com/c/kernel/common/+/2694466 to avoid build error issue with including include/trace/hooks/vmscan.h. Bug: 351175506 Change-Id: Iba3b71ade27c7d23787d26b3753e49a21358f0e8 Signed-off-by: Sooyong Suk <s.suk@samsung.corp-partner.google.com>
This commit is contained in:
parent
cebdeae238
commit
89d387d916
|
@ -442,3 +442,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_debug_show_areas);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_contig_range_not_isolated);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_contig_range_not_isolated);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_warn_alloc_tune_ratelimit);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_warn_alloc_tune_ratelimit);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_warn_alloc_show_mem_bypass);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_warn_alloc_show_mem_bypass);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_vm_swappiness);
|
||||||
|
|
|
@ -637,8 +637,16 @@ static inline void swap_free(swp_entry_t entry)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MEMCG
|
#ifdef CONFIG_MEMCG
|
||||||
|
extern void _trace_android_vh_use_vm_swappiness(bool *use_vm_swappiness);
|
||||||
|
|
||||||
static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
|
static inline int mem_cgroup_swappiness(struct mem_cgroup *memcg)
|
||||||
{
|
{
|
||||||
|
bool use_vm_swappiness = false;
|
||||||
|
|
||||||
|
_trace_android_vh_use_vm_swappiness(&use_vm_swappiness);
|
||||||
|
if (use_vm_swappiness)
|
||||||
|
return READ_ONCE(vm_swappiness);
|
||||||
|
|
||||||
/* Cgroup2 doesn't have per-cgroup swappiness */
|
/* Cgroup2 doesn't have per-cgroup swappiness */
|
||||||
if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
|
if (cgroup_subsys_on_dfl(memory_cgrp_subsys))
|
||||||
return READ_ONCE(vm_swappiness);
|
return READ_ONCE(vm_swappiness);
|
||||||
|
|
|
@ -61,6 +61,9 @@ DECLARE_HOOK(android_vh_file_is_tiny_bypass,
|
||||||
DECLARE_HOOK(android_vh_rebalance_anon_lru_bypass,
|
DECLARE_HOOK(android_vh_rebalance_anon_lru_bypass,
|
||||||
TP_PROTO(bool *bypass),
|
TP_PROTO(bool *bypass),
|
||||||
TP_ARGS(bypass));
|
TP_ARGS(bypass));
|
||||||
|
DECLARE_HOOK(android_vh_use_vm_swappiness,
|
||||||
|
TP_PROTO(bool *use_vm_swappiness),
|
||||||
|
TP_ARGS(use_vm_swappiness));
|
||||||
#endif /* _TRACE_HOOK_VMSCAN_H */
|
#endif /* _TRACE_HOOK_VMSCAN_H */
|
||||||
/* This part must be outside protection */
|
/* This part must be outside protection */
|
||||||
#include <trace/define_trace.h>
|
#include <trace/define_trace.h>
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
|
|
||||||
#include <trace/events/vmscan.h>
|
#include <trace/events/vmscan.h>
|
||||||
#include <trace/hooks/mm.h>
|
#include <trace/hooks/mm.h>
|
||||||
|
#include <trace/hooks/vmscan.h>
|
||||||
|
|
||||||
struct cgroup_subsys memory_cgrp_subsys __read_mostly;
|
struct cgroup_subsys memory_cgrp_subsys __read_mostly;
|
||||||
EXPORT_SYMBOL(memory_cgrp_subsys);
|
EXPORT_SYMBOL(memory_cgrp_subsys);
|
||||||
|
@ -251,6 +252,16 @@ struct mem_cgroup *vmpressure_to_memcg(struct vmpressure *vmpr)
|
||||||
return container_of(vmpr, struct mem_cgroup, vmpressure);
|
return container_of(vmpr, struct mem_cgroup, vmpressure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* trace_android_vh_use_vm_swappiness is called in include/linux/swap.h by
|
||||||
|
* including include/trace/hooks/vmscan.h, which will result to build-err.
|
||||||
|
* So we create func: _trace_android_vh_use_vm_swappiness.
|
||||||
|
*/
|
||||||
|
void _trace_android_vh_use_vm_swappiness(bool *use_vm_swappiness)
|
||||||
|
{
|
||||||
|
trace_android_vh_use_vm_swappiness(use_vm_swappiness);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_MEMCG_KMEM
|
#ifdef CONFIG_MEMCG_KMEM
|
||||||
static DEFINE_SPINLOCK(objcg_lock);
|
static DEFINE_SPINLOCK(objcg_lock);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user