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: <76d22c08-82db-4ea8-a7cd-c77589e132e3@redhat.com>
Date: Wed, 17 Apr 2024 10:19:52 +0200
From: David Hildenbrand <david@...hat.com>
To: Lance Yang <ioworker0@...il.com>
Cc: 21cnbao@...il.com, akpm@...ux-foundation.org, fengwei.yin@...el.com,
 linux-kernel@...r.kernel.org, linux-mm@...ck.org, mhocko@...e.com,
 minchan@...nel.org, peterx@...hat.com, ryan.roberts@....com,
 shy828301@...il.com, songmuchun@...edance.com, wangkefeng.wang@...wei.com,
 xiehuan09@...il.com, zokeefe@...gle.com
Subject: Re: [PATCH v7 1/3] mm/madvise: introduce clear_young_dirty_ptes()
 batch helper

On 17.04.24 07:04, Lance Yang wrote:
> Hey David, Ryan,
> 
> How about this change?
> 
> static inline void clear_young_dirty_ptes(struct vm_area_struct *vma,
> 					  unsigned long addr, pte_t *ptep,
> 					  unsigned int nr, cydp_t flags)
> {
> 	if (flags == CYDP_CLEAR_YOUNG) {
> 		for (;;) {
> 			ptep_test_and_clear_young(vma, addr, ptep);
> 			if (--nr == 0)
> 				break;
> 			ptep++;
> 			addr += PAGE_SIZE;
> 		}
> 		return;
> 	}
> 
> 	pte_t pte;
> 
> 	for (;;) {
> 		pte = ptep_get_and_clear(vma->vm_mm, addr, ptep);
> 
> 		if (flags & CYDP_CLEAR_YOUNG)
> 			pte = pte_mkold(pte);
> 		if (flags & CYDP_CLEAR_DIRTY)
> 			pte = pte_mkclean(pte);
> 
> 		if (--nr == 0)
> 			break;
> 		ptep++;
> 		addr += PAGE_SIZE;
> 	}
> }

Likely it might be best to just KIS for now and leave it as is. The 
compiler should optimize out based on flags already, that's what I ignored.

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ