ANDROID: 16K: Emulate cachestat counters
If emulating a larger page size adjust the cachestat page counters to match. Bug: 383389337 Bug: 404958693 Test: atest vts_ltp_test_x86_64:syscalls.cachestat01_64bit#syscalls.cachestat01_64bit Change-Id: I39581c7dce4b59d48096ede33730cc38dbc0680b Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
This commit is contained in:
committed by
Carlos Llamas
parent
0d44e1eb0e
commit
778a447513
@@ -174,6 +174,20 @@ static inline bool __is_emulated_pagemap_file(struct file *file)
|
||||
}
|
||||
#endif
|
||||
|
||||
static __always_inline void __adjust_cachestat_counters(struct cachestat *cs)
|
||||
{
|
||||
unsigned int nr_sub_pages = __PAGE_SIZE / PAGE_SIZE;
|
||||
|
||||
if (nr_sub_pages <= 1)
|
||||
return;
|
||||
|
||||
cs->nr_cache /= nr_sub_pages;
|
||||
cs->nr_dirty /= nr_sub_pages;
|
||||
cs->nr_writeback /= nr_sub_pages;
|
||||
cs->nr_evicted /= nr_sub_pages;
|
||||
cs->nr_recently_evicted /= nr_sub_pages;
|
||||
}
|
||||
|
||||
#endif /* !__ASSEMBLY__ */
|
||||
|
||||
#endif /* __LINUX_PAGE_SIZE_COMPAT_H */
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include <linux/psi.h>
|
||||
#include <linux/ramfs.h>
|
||||
#include <linux/page_idle.h>
|
||||
#include <linux/page_size_compat.h>
|
||||
#include <linux/migrate.h>
|
||||
#include <linux/pipe_fs_i.h>
|
||||
#include <linux/splice.h>
|
||||
@@ -4447,6 +4448,8 @@ resched:
|
||||
}
|
||||
}
|
||||
rcu_read_unlock();
|
||||
|
||||
__adjust_cachestat_counters(cs);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user