ANDROID: vendor_hook: Add hook in si_swapinfo()
Provide a vendor hook android_vh_si_swapinf to replace the process of updating nr_to_be_unused. When the page is swapped to a specified swap location, nr_to_be_unused should not be updated. Because the specified swap is regarded as a reserved extended memory. Bug: 234214858 Signed-off-by: Bing Han <bing.han@transsion.com> Change-Id: Ie41caec345658589bf908fb0f96d038d1fba21f3
This commit is contained in:

committed by
Treehugger Robot

parent
667f0d71dc
commit
ed2b11d639
@@ -423,4 +423,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snapshot_refaults);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_account_swap_pages);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_unuse_swap_page);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_swap_info_struct);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_init_swap_info_struct);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_swapinfo);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_si);
|
||||||
|
@@ -191,6 +191,9 @@ DECLARE_HOOK(android_vh_unuse_swap_page,
|
|||||||
DECLARE_HOOK(android_vh_init_swap_info_struct,
|
DECLARE_HOOK(android_vh_init_swap_info_struct,
|
||||||
TP_PROTO(struct swap_info_struct *p, struct plist_head *swap_avail_heads),
|
TP_PROTO(struct swap_info_struct *p, struct plist_head *swap_avail_heads),
|
||||||
TP_ARGS(p, swap_avail_heads));
|
TP_ARGS(p, swap_avail_heads));
|
||||||
|
DECLARE_HOOK(android_vh_si_swapinfo,
|
||||||
|
TP_PROTO(struct swap_info_struct *si, bool *skip),
|
||||||
|
TP_ARGS(si, skip));
|
||||||
DECLARE_HOOK(android_vh_alloc_si,
|
DECLARE_HOOK(android_vh_alloc_si,
|
||||||
TP_PROTO(struct swap_info_struct **p, bool *skip),
|
TP_PROTO(struct swap_info_struct **p, bool *skip),
|
||||||
TP_ARGS(p, skip));
|
TP_ARGS(p, skip));
|
||||||
|
@@ -3454,8 +3454,10 @@ void si_swapinfo(struct sysinfo *val)
|
|||||||
spin_lock(&swap_lock);
|
spin_lock(&swap_lock);
|
||||||
for (type = 0; type < nr_swapfiles; type++) {
|
for (type = 0; type < nr_swapfiles; type++) {
|
||||||
struct swap_info_struct *si = swap_info[type];
|
struct swap_info_struct *si = swap_info[type];
|
||||||
|
bool skip = false;
|
||||||
|
|
||||||
if ((si->flags & SWP_USED) && !(si->flags & SWP_WRITEOK))
|
trace_android_vh_si_swapinfo(si, &skip);
|
||||||
|
if (!skip && (si->flags & SWP_USED) && !(si->flags & SWP_WRITEOK))
|
||||||
nr_to_be_unused += si->inuse_pages;
|
nr_to_be_unused += si->inuse_pages;
|
||||||
}
|
}
|
||||||
val->freeswap = atomic_long_read(&nr_swap_pages) + nr_to_be_unused;
|
val->freeswap = atomic_long_read(&nr_swap_pages) + nr_to_be_unused;
|
||||||
|
Reference in New Issue
Block a user