On Wed 04-03-20 15:32:35, Adam Jackson wrote: > The page reclamation scanner tries to keep executable pages resident, > since taking a hard page fault to satisfy an icache miss is really not > great for interactivity. Anonymous executable pages tend to contain > code that has been just-in-time compiled for performance reasons. By > requiring that executable pages be file-backed, we're putting possibly > the most performance-sensitive code at higher risk of eviction, which > seems backwards. > > On an amd64 machine running Fedora 31, the firefox I happen to have > running requires about 89M of file-backed text and 12M of anonymous text > for 30 open tabs. The next largest process in terms of anonymous text is > gnome-shell, with 1M anonymous and 57M file-backed. No other process had > significant anonymous text, most had none. Penalizing those 13M > specifically when under memory pressure seems like an easy hazard to > avoid. Are you seeing an actual improvement from this change? IIRC the primary motivation to make this heuristic page cache oriented is that it was quite easy to evict file backed memory by streaming IO. This shouldn't really be a major problem for the anonymous memory in most cases. A heavy swapin/out workload is likely to suffer from not having data available more than having the code evicted. But I might be wrong here and getting some numbers would be really interesting. > Signed-off-by: Adam Jackson <ajax@xxxxxxxxxx> > --- > mm/vmscan.c | 11 ++++------- > 1 file changed, 4 insertions(+), 7 deletions(-) > > diff --git a/mm/vmscan.c b/mm/vmscan.c > index ee4eecc7e1c2..9bfbc30d61d8 100644 > --- a/mm/vmscan.c > +++ b/mm/vmscan.c > @@ -2095,15 +2095,12 @@ static void shrink_active_list(unsigned long nr_to_scan, > &vm_flags)) { > nr_rotated += hpage_nr_pages(page); > /* > - * Identify referenced, file-backed active pages and > - * give them one more trip around the active list. So > + * Identify referenced, executable active pages and > + * give them one more trip around the active list, so > * that executable code get better chances to stay in > - * memory under moderate memory pressure. Anon pages > - * are not likely to be evicted by use-once streaming > - * IO, plus JVM can create lots of anon VM_EXEC pages, > - * so we ignore them here. > + * memory under moderate memory pressure. > */ > - if ((vm_flags & VM_EXEC) && page_is_file_cache(page)) { > + if ((vm_flags & VM_EXEC)) { > list_add(&page->lru, &l_active); > continue; > } > -- > 2.23.0 > -- Michal Hocko SUSE Labs