ANDROID: vendor_hook: Add hook to abort reclaim and compaction
We need to abort the reclaim/compaction by sending signal(such as SIGUSR2) to the reclaim thread, or just abort when cpu-usage is too-high or free-mem is enough. Bug: 289987875 Change-Id: I4b637cbd2b37235eec27a985a9b5b95598247c59 Signed-off-by: shenjiangjiang <shenjiangjiang@oppo.com> (cherry picked from commit 024628cc9203cbd4f8471d98435b3a3d6f85764d)
This commit is contained in:
committed by
Todd Kjos
parent
adad2dab31
commit
28f1c8e015
@@ -488,6 +488,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_page);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_page);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dma_buf_stats_teardown);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_dma_buf_stats_teardown);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_madvise_cold_or_pageout_abort);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compact_finished);
|
||||||
/*
|
/*
|
||||||
* For type visibility
|
* For type visibility
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -338,6 +338,12 @@ DECLARE_HOOK(android_vh_look_around,
|
|||||||
TP_PROTO(struct page_vma_mapped_walk *pvmw, struct page *page,
|
TP_PROTO(struct page_vma_mapped_walk *pvmw, struct page *page,
|
||||||
struct vm_area_struct *vma, int *referenced),
|
struct vm_area_struct *vma, int *referenced),
|
||||||
TP_ARGS(pvmw, page, vma, referenced));
|
TP_ARGS(pvmw, page, vma, referenced));
|
||||||
|
DECLARE_HOOK(android_vh_compact_finished,
|
||||||
|
TP_PROTO(bool *abort_compact),
|
||||||
|
TP_ARGS(abort_compact));
|
||||||
|
DECLARE_HOOK(android_vh_madvise_cold_or_pageout_abort,
|
||||||
|
TP_PROTO(struct vm_area_struct *vma, bool *abort_madvise),
|
||||||
|
TP_ARGS(vma, abort_madvise));
|
||||||
/* macro versions of hooks are no longer required */
|
/* macro versions of hooks are no longer required */
|
||||||
|
|
||||||
#endif /* _TRACE_HOOK_MM_H */
|
#endif /* _TRACE_HOOK_MM_H */
|
||||||
|
|||||||
+8
-1
@@ -45,6 +45,11 @@ static inline void count_compact_events(enum vm_event_item item, long delta)
|
|||||||
#define CREATE_TRACE_POINTS
|
#define CREATE_TRACE_POINTS
|
||||||
#include <trace/events/compaction.h>
|
#include <trace/events/compaction.h>
|
||||||
|
|
||||||
|
#undef CREATE_TRACE_POINTS
|
||||||
|
#ifndef __GENKSYMS__
|
||||||
|
#include <trace/hooks/mm.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#define block_start_pfn(pfn, order) round_down(pfn, 1UL << (order))
|
#define block_start_pfn(pfn, order) round_down(pfn, 1UL << (order))
|
||||||
#define block_end_pfn(pfn, order) ALIGN((pfn) + 1, 1UL << (order))
|
#define block_end_pfn(pfn, order) ALIGN((pfn) + 1, 1UL << (order))
|
||||||
#define pageblock_start_pfn(pfn) block_start_pfn(pfn, pageblock_order)
|
#define pageblock_start_pfn(pfn) block_start_pfn(pfn, pageblock_order)
|
||||||
@@ -1984,6 +1989,7 @@ static enum compact_result __compact_finished(struct compact_control *cc)
|
|||||||
unsigned int order;
|
unsigned int order;
|
||||||
const int migratetype = cc->migratetype;
|
const int migratetype = cc->migratetype;
|
||||||
int ret;
|
int ret;
|
||||||
|
bool abort_compact = false;
|
||||||
|
|
||||||
/* Compaction run completes if the migrate and free scanner meet */
|
/* Compaction run completes if the migrate and free scanner meet */
|
||||||
if (compact_scanners_met(cc)) {
|
if (compact_scanners_met(cc)) {
|
||||||
@@ -2083,7 +2089,8 @@ static enum compact_result __compact_finished(struct compact_control *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (cc->contended || fatal_signal_pending(current))
|
trace_android_vh_compact_finished(&abort_compact);
|
||||||
|
if (cc->contended || fatal_signal_pending(current) || abort_compact)
|
||||||
ret = COMPACT_CONTENDED;
|
ret = COMPACT_CONTENDED;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
+3
-1
@@ -322,8 +322,10 @@ static int madvise_cold_or_pageout_pte_range(pmd_t *pmd,
|
|||||||
struct page *page = NULL;
|
struct page *page = NULL;
|
||||||
LIST_HEAD(page_list);
|
LIST_HEAD(page_list);
|
||||||
bool allow_shared = false;
|
bool allow_shared = false;
|
||||||
|
bool abort_madvise = false;
|
||||||
|
|
||||||
if (fatal_signal_pending(current))
|
trace_android_vh_madvise_cold_or_pageout_abort(vma, &abort_madvise);
|
||||||
|
if (fatal_signal_pending(current) || abort_madvise)
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
|
|
||||||
trace_android_vh_madvise_cold_or_pageout(vma, &allow_shared);
|
trace_android_vh_madvise_cold_or_pageout(vma, &allow_shared);
|
||||||
|
|||||||
Reference in New Issue
Block a user