Make SPLIT_RSS_COUNTING configurable
Subsystems (4)
PATCH 1/1 Make SPLIT_RSS_COUNTING configurable
Using the new config option, users can disable SPLIT_RSS_COUNTING to get increased accuracy in user-visible mm counters.
--- include/linux/mm.h | 4 ++-- include/linux/mm_types_task.h | 5 ++--- include/linux/sched.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 11 +++++++++++ mm/memory.c | 6 +++--- 6 files changed, 20 insertions(+), 10 deletions(-)
include/linux/mm.h +2 -2
@@ -1637,7 +1637,7 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) {long val =atomic_long_read (&mm->rss_stat.count[member]); -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* * counter is updated in asynchronous manner and may go to minus. * But it's never be expected number for users.
@@ -1723,7 +1723,7 @@ static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, *maxrss = hiwater_rss; } -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING void sync_mm_rss (struct mm_struct *mm);#else static inline void sync_mm_rss (struct mm_struct *mm)
include/linux/mm_types_task.h +2 -3
@@ -48,14 +48,13 @@ enum {NR_MM_COUNTERS }; -#if USE_SPLIT_PTE_PTLOCKS && defined(CONFIG_MMU ) -#define SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* per-thread cached information, */ struct task_rss_stat {int events;/* for synchronization threshold */ int count[NR_MM_COUNTERS ]; }; -#endif /* USE_SPLIT_PTE_PTLOCKS */ +#endif /* CONFIG_SPLIT_RSS_COUNTING */ struct mm_rss_stat {atomic_long_t count[NR_MM_COUNTERS ];
include/linux/sched.h +1 -1
@@ -729,7 +729,7 @@ struct task_struct {/* Per-thread vma caching: */ struct vmacache vmacache; -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING struct task_rss_stat rss_stat;#endif int exit_state;
kernel/fork.c +1 -1
@@ -1917,7 +1917,7 @@ static __latent_entropy struct task_struct *copy_process( p->vtime.state =VTIME_INACTIVE ;#endif -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING memset (&p->rss_stat,0 ,sizeof (p->rss_stat));#endif
mm/Kconfig +11 -0
@@ -736,4 +736,15 @@ config ARCH_HAS_PTE_SPECIAL config ARCH_HAS_HUGEPD bool +config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUS + help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracy + of memory statistics in /proc. + endmenu
mm/memory.c +3 -3
@@ -141,7 +141,7 @@ static int __init init_zero_pfn(void)core_initcall (init_zero_pfn); -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING void sync_mm_rss (struct mm_struct *mm) {
@@ -177,7 +177,7 @@ static void check_sync_rss_stat(struct task_struct *task)if (unlikely (task->rss_stat.events++ >TASK_RSS_EVENTS_THRESH )) sync_mm_rss(task->mm); } -#else /* SPLIT_RSS_COUNTING */ +#else /* CONFIG_SPLIT_RSS_COUNTING */ #define inc_mm_counter_fast (mm, member) inc_mm_counter(mm, member)#define dec_mm_counter_fast (mm, member) dec_mm_counter(mm, member)
@@ -186,7 +186,7 @@ static void check_sync_rss_stat(struct task_struct *task) { } -#endif /* SPLIT_RSS_COUNTING */ +#endif /* CONFIG_SPLIT_RSS_COUNTING */ /* * Note: this doesn't free the actual pages themselves. That
Signature · 1 line
2.23.0.581.g78d2f28ef7-goog
Adding the correct linux-mm address.
Quoted 137 lines · Daniel Colascione
Using the new config option, users can disable
SPLIT_RSS_COUNTINGto get increased accuracy in user-visible mm counters.Signed-off-by Daniel Colascione <[email protected]>--- include/linux/mm.h | 4 ++-- include/linux/mm_types_task.h | 5 ++--- include/linux/sched.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 11 +++++++++++ mm/memory.c | 6 +++--- 6 files changed, 20 insertions(+), 10 deletions(-)include/linux/mm.h +2
-2@@ -1637,7 +1637,7 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) {long val =atomic_long_read (&mm->rss_stat.count[member]); -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* * counter is updated in asynchronous manner and may go to minus. * But it's never be expected number for users. @@ -1723,7 +1723,7 @@ static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, *maxrss = hiwater_rss; } -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING void sync_mm_rss (struct mm_struct *mm);#else static inline void sync_mm_rss (struct mm_struct *mm)include/linux/mm_types_task.h +2
-3@@ -48,14 +48,13 @@ enum {NR_MM_COUNTERS }; -#if USE_SPLIT_PTE_PTLOCKS && defined(CONFIG_MMU ) -#define SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* per-thread cached information, */ struct task_rss_stat {int events;/* for synchronization threshold */ int count[NR_MM_COUNTERS ]; }; -#endif /* USE_SPLIT_PTE_PTLOCKS */ +#endif /* CONFIG_SPLIT_RSS_COUNTING */ struct mm_rss_stat {atomic_long_t count[NR_MM_COUNTERS ];include/linux/sched.h +1
-1@@ -729,7 +729,7 @@ struct task_struct {/* Per-thread vma caching: */ struct vmacache vmacache; -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING struct task_rss_stat rss_stat;#endif int exit_state;kernel/fork.c +1
-1@@ -1917,7 +1917,7 @@ static __latent_entropy struct task_struct *copy_process( p->vtime.state =VTIME_INACTIVE ;#endif -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING memset (&p->rss_stat,0 ,sizeof (p->rss_stat));#endif mm/Kconfig +11
-0@@ -736,4 +736,15 @@ config ARCH_HAS_PTE_SPECIAL config ARCH_HAS_HUGEPD bool +config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUS + help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracy + of memory statistics in /proc. + endmenumm/memory.c +3
-4@@ -141,7 +141,7 @@ static int __init init_zero_pfn(void)core_initcall (init_zero_pfn); -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING void sync_mm_rss (struct mm_struct *mm) {@@ -177,7 +177,7 @@ static void check_sync_rss_stat(struct task_struct *task)if (unlikely (task->rss_stat.events++ >TASK_RSS_EVENTS_THRESH )) sync_mm_rss(task->mm); } -#else /* SPLIT_RSS_COUNTING */ +#else /* CONFIG_SPLIT_RSS_COUNTING */ #define inc_mm_counter_fast (mm, member) inc_mm_counter(mm, member)#define dec_mm_counter_fast (mm, member) dec_mm_counter(mm, member)@@ -186,7 +186,7 @@ static void check_sync_rss_stat(struct task_struct *task) { } -#endif /* SPLIT_RSS_COUNTING */ +#endif /* CONFIG_SPLIT_RSS_COUNTING */ /* * Note: this doesn't free the actual pages themselves. That -- 2.23.0.581.g78d2f28ef7-goog
Quoted 99 lines · Daniel Colascione
Adding the correct linux-mm address.
Quoted 92 lines · Daniel Colascione
Using the new config option, users can disable
SPLIT_RSS_COUNTINGto get increased accuracy in user-visible mm counters.Signed-off-by Daniel Colascione <[email protected]>---
include/linux/mm.h | 4 ++-- include/linux/mm_types_task.h | 5 ++--- include/linux/sched.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 11 +++++++++++ mm/memory.c | 6 +++--- 6 files changed, 20 insertions(+), 10 deletions(-)include/linux/mm.h +2
-2@@ -1637,7 +1637,7 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) {long val =atomic_long_read (&mm->rss_stat.count[member]); -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* * counter is updated in asynchronous manner and may go to minus. * But it's never be expected number for users. @@ -1723,7 +1723,7 @@ static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, *maxrss = hiwater_rss; } -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING void sync_mm_rss (struct mm_struct *mm);#else static inline void sync_mm_rss (struct mm_struct *mm)include/linux/mm_types_task.h +2
-3@@ -48,14 +48,13 @@ enum {NR_MM_COUNTERS }; -#if USE_SPLIT_PTE_PTLOCKS && defined(CONFIG_MMU ) -#define SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* per-thread cached information, */ struct task_rss_stat {int events;/* for synchronization threshold */ int count[NR_MM_COUNTERS ]; }; -#endif /* USE_SPLIT_PTE_PTLOCKS */ +#endif /* CONFIG_SPLIT_RSS_COUNTING */ struct mm_rss_stat {atomic_long_t count[NR_MM_COUNTERS ];include/linux/sched.h +1
-1@@ -729,7 +729,7 @@ struct task_struct {/* Per-thread vma caching: */ struct vmacache vmacache; -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING struct task_rss_stat rss_stat;#endif int exit_state;kernel/fork.c +1
-1@@ -1917,7 +1917,7 @@ static __latent_entropy struct task_struct *copy_process( p->vtime.state =VTIME_INACTIVE ;#endif -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING memset (&p->rss_stat,0 ,sizeof (p->rss_stat));#endif mm/Kconfig +0
-0@@ -736,4 +736,15 @@ config ARCH_HAS_PTE_SPECIALconfig
ARCH_HAS_HUGEPD
bool
Quoted 12 lines
Quoted 11 lines
mm/Kconfig +11
-0+config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUS + help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracy + of memory statistics in /proc. +Quoted 1 line
endmenu
All those vague words are going to make developers almost impossible to decide the right selection here. It sounds like we should kill SPLIT_RSS_COUNTING at all to simplify the code as the benefit is so small vs the side-effect?
Quoted 34 lines
Quoted 34 lines
mm/memory.c +3
-4@@ -141,7 +141,7 @@ static int __init init_zero_pfn(void)core_initcall (init_zero_pfn); -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING void sync_mm_rss (struct mm_struct *mm) {@@ -177,7 +177,7 @@ static void check_sync_rss_stat(struct task_struct *task)if (unlikely (task->rss_stat.events++ >TASK_RSS_EVENTS_THRESH )) sync_mm_rss(task->mm); } -#else /* SPLIT_RSS_COUNTING */ +#else /* CONFIG_SPLIT_RSS_COUNTING */ #define inc_mm_counter_fast (mm, member) inc_mm_counter(mm, member)#define dec_mm_counter_fast (mm, member) dec_mm_counter(mm, member)@@ -186,7 +186,7 @@ static void check_sync_rss_stat(struct task_struct *task) { } -#endif /* SPLIT_RSS_COUNTING */ +#endif /* CONFIG_SPLIT_RSS_COUNTING */ /* * Note: this doesn't free the actual pages themselves. That -- 2.23.0.581.g78d2f28ef7-goog
Quoted 97 lines · Qian Cai
Quoted 97 lines · Daniel Colascione
Adding the correct linux-mm address.
Quoted 92 lines · Daniel Colascione
Using the new config option, users can disable
SPLIT_RSS_COUNTINGto get increased accuracy in user-visible mm counters.Signed-off-by Daniel Colascione <[email protected]>---
include/linux/mm.h | 4 ++-- include/linux/mm_types_task.h | 5 ++--- include/linux/sched.h | 2 +- kernel/fork.c | 2 +- mm/Kconfig | 11 +++++++++++ mm/memory.c | 6 +++--- 6 files changed, 20 insertions(+), 10 deletions(-)include/linux/mm.h +2
-2@@ -1637,7 +1637,7 @@ static inline unsigned long get_mm_counter(struct mm_struct *mm, int member) {long val =atomic_long_read (&mm->rss_stat.count[member]); -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* * counter is updated in asynchronous manner and may go to minus. * But it's never be expected number for users. @@ -1723,7 +1723,7 @@ static inline void setmax_mm_hiwater_rss(unsigned long *maxrss, *maxrss = hiwater_rss; } -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING void sync_mm_rss (struct mm_struct *mm);#else static inline void sync_mm_rss (struct mm_struct *mm)include/linux/mm_types_task.h +2
-3@@ -48,14 +48,13 @@ enum {NR_MM_COUNTERS }; -#if USE_SPLIT_PTE_PTLOCKS && defined(CONFIG_MMU ) -#define SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING /* per-thread cached information, */ struct task_rss_stat {int events;/* for synchronization threshold */ int count[NR_MM_COUNTERS ]; }; -#endif /* USE_SPLIT_PTE_PTLOCKS */ +#endif /* CONFIG_SPLIT_RSS_COUNTING */ struct mm_rss_stat {atomic_long_t count[NR_MM_COUNTERS ];include/linux/sched.h +1
-1@@ -729,7 +729,7 @@ struct task_struct {/* Per-thread vma caching: */ struct vmacache vmacache; -#ifdef SPLIT_RSS_COUNTING +#ifdef CONFIG_SPLIT_RSS_COUNTING struct task_rss_stat rss_stat;#endif int exit_state;kernel/fork.c +1
-1@@ -1917,7 +1917,7 @@ static __latent_entropy struct task_struct *copy_process( p->vtime.state =VTIME_INACTIVE ;#endif -#if defined(SPLIT_RSS_COUNTING ) +#ifdef CONFIG_SPLIT_RSS_COUNTING memset (&p->rss_stat,0 ,sizeof (p->rss_stat));#endif mm/Kconfig +0
-0@@ -736,4 +736,15 @@ config ARCH_HAS_PTE_SPECIALconfig
ARCH_HAS_HUGEPD
bool
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
mm/Kconfig +4
-0+config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUSQuoted 8 lines
Quoted 8 lines
mm/Kconfig +7
-0+ help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracy + of memory statistics in /proc. +endmenu
All those vague words are going to make developers almost impossible to decide the right selection here. It sounds like we should kill
SPLIT_RSS_COUNTINGat all to simplify the code as the benefit is so small vs the side-effect?
Killing SPLIT_RSS_COUNTING would be my first choice; IME, on mobile and a basic desktop, it doesn't make a difference. I figured making it a knob would help allay concerns about the performance impact in more extreme configurations.
Quoted 21 lines · Daniel Colascione
Quoted 5 lines · Qian Cai
Quoted 5 lines · Daniel Colascione
Adding the correct linux-mm address.
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
mm/Kconfig +4
-0+config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUSQuoted 8 lines
Quoted 8 lines
mm/Kconfig +7
-0+ help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracy + of memory statistics in /proc. +endmenu
All those vague words are going to make developers almost impossible to decide the right selection here. It sounds like we should kill
SPLIT_RSS_COUNTINGat all to simplify the code as the benefit is so small vs the side-effect?
Quoted 4 lines
Killing
SPLIT_RSS_COUNTINGwould be my first choice; IME, on mobile and a basic desktop, it doesn't make a difference. I figured making it a knob would help allay concerns about the performance impact in more extreme configurations.
I do agree with Qian. Either it is really helpful (is it? probably on the number of cpus) and it should be auto-enabled or it should be dropped altogether. You cannot really expect people know how to enable this without a deep understanding of the MM internals. Not to mention all those users using distro kernels/configs.
A config option sounds like a bad way forward.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 27 lines · Michal Hocko
Quoted 21 lines · Daniel Colascione
Quoted 5 lines · Qian Cai
Quoted 5 lines · Daniel Colascione
Adding the correct linux-mm address.
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
mm/Kconfig +4
-0+config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUSQuoted 8 lines
Quoted 8 lines
mm/Kconfig +7
-0+ help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracy + of memory statistics in /proc. +endmenu
All those vague words are going to make developers almost impossible to decide the right selection here. It sounds like we should kill
SPLIT_RSS_COUNTINGat all to simplify the code as the benefit is so small vs the side-effect?Quoted 4 lines
Killing
SPLIT_RSS_COUNTINGwould be my first choice; IME, on mobile and a basic desktop, it doesn't make a difference. I figured making it a knob would help allay concerns about the performance impact in more extreme configurations.
Quoted 7 lines
I do agree with Qian. Either it is really helpful (is it? probably on the number of cpus) and it should be auto-enabled or it should be dropped altogether. You cannot really expect people know how to enable this without a deep understanding of the MM internals. Not to mention all those users using distro kernels/configs.
A config option sounds like a bad way forward.
And I don't see much point anyway. Reading RSS counters from proc is inherently racy. It can just either way after the read due to process behaviour.
Signature · 1 line
Kirill A. Shutemov
Quoted 34 lines · Kirill A. Shutemov
Quoted 33 lines · Michal Hocko
Quoted 21 lines · Daniel Colascione
Quoted 5 lines · Qian Cai
Quoted 5 lines · Daniel Colascione
Adding the correct linux-mm address.
Quoted 14 lines
Quoted 4 lines
Quoted 4 lines
mm/Kconfig +4
-0+config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUSQuoted 8 lines
Quoted 8 lines
mm/Kconfig +7
-0+ help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracy + of memory statistics in /proc. +endmenu
All those vague words are going to make developers almost impossible to decide the right selection here. It sounds like we should kill
SPLIT_RSS_COUNTINGat all to simplify the code as the benefit is so small vs the side-effect?Quoted 4 lines
Killing
SPLIT_RSS_COUNTINGwould be my first choice; IME, on mobile and a basic desktop, it doesn't make a difference. I figured making it a knob would help allay concerns about the performance impact in more extreme configurations.I do agree with Qian. Either it is really helpful (is it? probably on the number of cpus) and it should be auto-enabled or it should be dropped altogether. You cannot really expect people know how to enable this without a deep understanding of the MM internals. Not to mention all those users using distro kernels/configs.
Quoted 5 lines
Quoted 1 line
A config option sounds like a bad way forward.
And I don't see much point anyway. Reading RSS counters from proc is inherently racy. It can just either way after the read due to process behaviour.
Split RSS accounting doesn't make reading from mm counters racy. It makes these counters *wrong*. We flush task mm counters to the mm_struct once every 64 page faults that a task incurs or when that task exits. That means that if a thread takes 63 page faults and then sleeps for a week, that thread's process's mm counters are wrong by 63 pages *for a week*. And some processes have a lot of threads, compounding the error. Split RSS accounting means that memory usage numbers don't add up. I don't think it's unreasonable to want a mode where memory counters to agree with other indicators of system activity.
Nobody has demonstrated that split RSS accounting actually helps in the real world. But I've described above, concretely, how split RSS accounting hurts. I've been trying for over a year to either disable split RSS accounting or to let people opt out of it. If you won't remove split RSS accounting and you won't let me add a configuration knob that lets people opt out of it, what will you accept?
On Fri 04-10-19 06:45:21, Daniel Colascione wrote:
[...]
Quoted 6 lines
Nobody has demonstrated that split RSS accounting actually helps in the real world. But I've described above, concretely, how split RSS accounting hurts. I've been trying for over a year to either disable split RSS accounting or to let people opt out of it. If you won't remove split RSS accounting and you won't let me add a configuration knob that lets people opt out of it, what will you accept?
What is an argument to keep it around?
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 44 lines · Daniel Colascione
Quoted 37 lines · Kirill A. Shutemov
Quoted 36 lines · Michal Hocko
Quoted 24 lines · Daniel Colascione
Quoted 14 lines · Qian Cai
Quoted 14 lines · Daniel Colascione
Adding the correct linux-mm address.
Quoted 9 lines
(quoted diff) +9
-0+config SPLIT_RSS_COUNTING + bool "Per-thread mm counter caching" + depends on MMU + default y if NR_CPUS >= SPLIT_PTLOCK_CPUS + help + Cache mm counter updates in thread structures and + flush them to visible per-process statistics in batches. + Say Y here to slightly reduce cache contention in processes + with many threads at the expense of decreasing the accuracyQuoted 8 lines
Quoted 3 lines
Quoted 3 lines
(quoted diff) +2
-0+ of memory statistics in /proc. +endmenu
All those vague words are going to make developers almost impossible to decide the right selection here. It sounds like we should kill
SPLIT_RSS_COUNTINGat all to simplify the code as the benefit is so small vs the side-effect?Quoted 4 lines
Killing
SPLIT_RSS_COUNTINGwould be my first choice; IME, on mobile and a basic desktop, it doesn't make a difference. I figured making it a knob would help allay concerns about the performance impact in more extreme configurations.I do agree with Qian. Either it is really helpful (is it? probably on the number of cpus) and it should be auto-enabled or it should be dropped altogether. You cannot really expect people know how to enable this without a deep understanding of the MM internals. Not to mention all those users using distro kernels/configs.
Quoted 5 lines
Quoted 1 line
A config option sounds like a bad way forward.
And I don't see much point anyway. Reading RSS counters from proc is inherently racy. It can just either way after the read due to process behaviour.
Quoted 10 lines
Split RSS accounting doesn't make reading from mm counters racy. It makes these counters *wrong*. We flush task mm counters to the
mm_structonce every 64 page faults that a task incurs or when that task exits. That means that if a thread takes 63 page faults and then sleeps for a week, that thread's process's mm counters are wrong by 63 pages *for a week*. And some processes have a lot of threads, compounding the error. Split RSS accounting means that memory usage numbers don't add up. I don't think it's unreasonable to want a mode where memory counters to agree with other indicators of system activity.
It's documented behaviour that is upstream for 9 years. Why is your workload special?
The documentation suggests to use smaps if you want to have precise data. Why would it not fly for you?
Quoted 2 lines
Nobody has demonstrated that split RSS accounting actually helps in the real world.
The original commit 34e55232e59f ("mm: avoid false sharing of mm_counter") shows numbers on cache misses. It's not a real world workload, but you don't have any numbers at all to back your claim.
Quoted 5 lines
But I've described above, concretely, how split RSS accounting hurts. I've been trying for over a year to either disable split RSS accounting or to let people opt out of it. If you won't remove split RSS accounting and you won't let me add a configuration knob that lets people opt out of it, what will you accept?
Keeping stats precise is welcome, but often expensive. It might be negligible for small machine, but becomes a problem on multisocket machine with dozens or hundreds of cores. We need to keep kernel scalable.
We have other stats that update asynchronously (i.e. /proc/vmstat). Would you like to convert them too?
Signature · 1 line
Kirill A. Shutemov