mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
delayacct: support re-entrance detection of thrashing accounting
Once upon a time, we only support accounting thrashing of page cache.
Then Joonsoo introduced workingset detection for anonymous pages and we
gained the ability to account thrashing of them[1].
For page cache thrashing accounting, there is no suitable place to do it
in fs level likes swap_readpage(). So we have to do it in
folio_wait_bit_common().
Then for anonymous pages thrashing accounting, we have to do it in both
swap_readpage() and folio_wait_bit_common(). This likes PSI, so we should
let thrashing accounting supports re-entrance detection.
This patch is to prepare complete thrashing accounting, and is based on
patch "filemap: make the accounting of thrashing more consistent".
[1] commit aae466b005
("mm/swap: implement workingset detection for anonymous LRU")
Link: https://lkml.kernel.org/r/20220815071134.74551-1-yang.yang29@zte.com.cn
Signed-off-by: Yang Yang <yang.yang29@zte.com.cn>
Signed-off-by: CGEL ZTE <cgel.zte@gmail.com>
Reviewed-by: Ran Xiaokai <ran.xiaokai@zte.com.cn>
Reviewed-by: wangyong <wang.yong12@zte.com.cn>
Acked-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
@@ -73,8 +73,8 @@ extern int delayacct_add_tsk(struct taskstats *, struct task_struct *);
|
||||
extern __u64 __delayacct_blkio_ticks(struct task_struct *);
|
||||
extern void __delayacct_freepages_start(void);
|
||||
extern void __delayacct_freepages_end(void);
|
||||
extern void __delayacct_thrashing_start(void);
|
||||
extern void __delayacct_thrashing_end(void);
|
||||
extern void __delayacct_thrashing_start(bool *in_thrashing);
|
||||
extern void __delayacct_thrashing_end(bool *in_thrashing);
|
||||
extern void __delayacct_swapin_start(void);
|
||||
extern void __delayacct_swapin_end(void);
|
||||
extern void __delayacct_compact_start(void);
|
||||
@@ -143,22 +143,22 @@ static inline void delayacct_freepages_end(void)
|
||||
__delayacct_freepages_end();
|
||||
}
|
||||
|
||||
static inline void delayacct_thrashing_start(void)
|
||||
static inline void delayacct_thrashing_start(bool *in_thrashing)
|
||||
{
|
||||
if (!static_branch_unlikely(&delayacct_key))
|
||||
return;
|
||||
|
||||
if (current->delays)
|
||||
__delayacct_thrashing_start();
|
||||
__delayacct_thrashing_start(in_thrashing);
|
||||
}
|
||||
|
||||
static inline void delayacct_thrashing_end(void)
|
||||
static inline void delayacct_thrashing_end(bool *in_thrashing)
|
||||
{
|
||||
if (!static_branch_unlikely(&delayacct_key))
|
||||
return;
|
||||
|
||||
if (current->delays)
|
||||
__delayacct_thrashing_end();
|
||||
__delayacct_thrashing_end(in_thrashing);
|
||||
}
|
||||
|
||||
static inline void delayacct_swapin_start(void)
|
||||
@@ -237,9 +237,9 @@ static inline void delayacct_freepages_start(void)
|
||||
{}
|
||||
static inline void delayacct_freepages_end(void)
|
||||
{}
|
||||
static inline void delayacct_thrashing_start(void)
|
||||
static inline void delayacct_thrashing_start(bool *in_thrashing)
|
||||
{}
|
||||
static inline void delayacct_thrashing_end(void)
|
||||
static inline void delayacct_thrashing_end(bool *in_thrashing)
|
||||
{}
|
||||
static inline void delayacct_swapin_start(void)
|
||||
{}
|
||||
|
Reference in New Issue
Block a user