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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <28285925-a97b-4ce2-8762-f764c7345064@redhat.com>
Date: Mon, 6 May 2024 10:14:58 +0200
From: David Hildenbrand <david@...hat.com>
To: Barry Song <21cnbao@...il.com>, akpm@...ux-foundation.org,
 linux-mm@...ck.org
Cc: baolin.wang@...ux.alibaba.com, chrisl@...nel.org, hanchuanhua@...o.com,
 hannes@...xchg.org, hughd@...gle.com, kasong@...cent.com,
 linux-kernel@...r.kernel.org, ryan.roberts@....com, surenb@...gle.com,
 v-songbaohua@...o.com, willy@...radead.org, xiang@...nel.org,
 ying.huang@...el.com, yosryahmed@...gle.com, yuzhao@...gle.com,
 ziy@...dia.com
Subject: Re: [PATCH v3 5/6] mm: swap: make should_try_to_free_swap() support
 large-folio

On 03.05.24 02:50, Barry Song wrote:
> From: Chuanhua Han <hanchuanhua@...o.com>
> 
> The function should_try_to_free_swap() operates under the assumption
> that swap-in always occurs at the normal page granularity,
> i.e., folio_nr_pages() = 1. However, in reality, for large folios,
> add_to_swap_cache() will invoke folio_ref_add(folio, nr).  To accommodate
> large folio swap-in, this patch eliminates this assumption.
> 
> Signed-off-by: Chuanhua Han <hanchuanhua@...o.com>
> Co-developed-by: Barry Song <v-songbaohua@...o.com>
> Signed-off-by: Barry Song <v-songbaohua@...o.com>
> Acked-by: Chris Li <chrisl@...nel.org>
> Reviewed-by: Ryan Roberts <ryan.roberts@....com>
> Reviewed-by: "Huang, Ying" <ying.huang@...el.com>
> ---
>   mm/memory.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/mm/memory.c b/mm/memory.c
> index 74cdefd58f5f..22e7c33cc747 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -3877,7 +3877,7 @@ static inline bool should_try_to_free_swap(struct folio *folio,
>   	 * reference only in case it's likely that we'll be the exlusive user.
>   	 */
>   	return (fault_flags & FAULT_FLAG_WRITE) && !folio_test_ksm(folio) &&
> -		folio_ref_count(folio) == 2;
> +		folio_ref_count(folio) == (1 + folio_nr_pages(folio));
>   }
>   
>   static vm_fault_t pte_marker_clear(struct vm_fault *vmf)


Reviewed-by: David Hildenbrand <david@...hat.com>

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ