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: <Zfr5QgvplFSury6o@casper.infradead.org>
Date: Wed, 20 Mar 2024 14:57:06 +0000
From: Matthew Wilcox <willy@...radead.org>
To: alexs@...nel.org
Cc: Izik Eidus <izik.eidus@...ellosystems.com>,
	Andrea Arcangeli <aarcange@...hat.com>,
	Hugh Dickins <hughd@...gle.com>, Chris Wright <chrisw@...s-sol.org>,
	kasong@...cent.com, Andrew Morton <akpm@...ux-foundation.org>,
	"open list:MEMORY MANAGEMENT" <linux-mm@...ck.org>,
	open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 06/11] mm/ksm: use folio in write_protect_page

On Wed, Mar 20, 2024 at 03:40:42PM +0800, alexs@...nel.org wrote:
> -static int write_protect_page(struct vm_area_struct *vma, struct page *page,
> +static int write_protect_page(struct vm_area_struct *vma, struct folio *folio,
>  			      pte_t *orig_pte)
>  {
>  	struct mm_struct *mm = vma->vm_mm;
> -	DEFINE_PAGE_VMA_WALK(pvmw, page, vma, 0, 0);
> +	DEFINE_PAGE_VMA_WALK(pvmw, &folio->page, vma, 0, 0);

We have a DEFINE_FOLIO_VMA_WALK

> -	pvmw.address = page_address_in_vma(page, vma);
> +	pvmw.address = page_address_in_vma(&folio->page, vma);

We don't yet have a folio_address_in_vma().  This needs more study,
so I approve of how you've converted this line.

> -	BUG_ON(PageTransCompound(page));

I might make this a VM_BUG_ON(folio_test_large(folio))

> @@ -1505,7 +1503,7 @@ static int try_to_merge_one_page(struct vm_area_struct *vma,
>  	 * ptes are necessarily already write-protected.  But in either
>  	 * case, we need to lock and check page_count is not raised.
>  	 */
> -	if (write_protect_page(vma, page, &orig_pte) == 0) {
> +	if (write_protect_page(vma, (struct folio *)page, &orig_pte) == 0) {

I don't love this cast.  I see why it's safe (called split_huge_page()
above), but I'd rather see a call to page_folio() just to keep things
tidy.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ