lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230316143007.GC116016@cmpxchg.org>
Date:   Thu, 16 Mar 2023 10:30:07 -0400
From:   Johannes Weiner <hannes@...xchg.org>
To:     yang.yang29@....com.cn
Cc:     akpm@...ux-foundation.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, iamjoonsoo.kim@....com, willy@...radead.org
Subject: Re:  [PATCH linux-next] mm: workingset: simplify the calculation of workingset size

On Thu, Mar 16, 2023 at 05:23:05PM +0800, yang.yang29@....com.cn wrote:
> From: Yang Yang <yang.yang29@....com.cn>
> 
> After we implemented workingset detection for anonymous LRU[1],
> the calculation of workingset size is a little complex. Actually there is
> no need to call mem_cgroup_get_nr_swap_pages() if refault page is
> anonymous page, since we are doing swapping then should always
> give pressure to NR_ACTIVE_ANON.

This is false.

(mem_cgroup_)get_nr_swap_pages() returns the *free swap slots*. There
might be swap, but if it's full, reclaim stops scanning anonymous
pages altogether. That means that refaults of either type can no
longer displace existing anonymous pages, only cache.

So yes, all refaults need to check free swap to determine how to act
on the reuse frequency.

> @@ -466,22 +466,23 @@ void workingset_refault(struct folio *folio, void *shadow)
>  	/*
>  	 * 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.

No, it applies to all refaults, not just cache.

What could help is changing the comment to "having free swap space".

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ