On Thu, Mar 16, 2023 at 05:23:05PM +0800, yang.yang29@xxxxxxxxxx wrote: > * Compare the distance to the existing workingset size. We > * don't activate pages that couldn't stay resident even if > - * all the memory was available to the workingset. Whether > - * workingset competition needs to consider anon or not depends > - * on having swap. > + * all the memory was available to the workingset. For page > + * cache whether workingset competition needs to consider > + * anon or not depends on having swap. I don't mind this change > */ > workingset_size = lruvec_page_state(eviction_lruvec, NR_ACTIVE_FILE); > + /* For anonymous page */ This comment adds no value > if (!file) { > + workingset_size += lruvec_page_state(eviction_lruvec, > + NR_ACTIVE_ANON); > workingset_size += lruvec_page_state(eviction_lruvec, > NR_INACTIVE_FILE); > - } > - if (mem_cgroup_get_nr_swap_pages(eviction_memcg) > 0) { > + /* For page cache */ Nor this one > + } else if (mem_cgroup_get_nr_swap_pages(eviction_memcg) > 0) { > workingset_size += lruvec_page_state(eviction_lruvec, > NR_ACTIVE_ANON); > - if (file) { > - workingset_size += lruvec_page_state(eviction_lruvec, > + workingset_size += lruvec_page_state(eviction_lruvec, > NR_INACTIVE_ANON); > - } > } I don't have an opinion on the actual code changes.