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: <20240411125723.GT5383@nvidia.com>
Date: Thu, 11 Apr 2024 09:57:23 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Alistair Popple <apopple@...dia.com>
Cc: linux-mm@...ck.org, david@...morbit.com, dan.j.williams@...el.com,
	jhubbard@...dia.com, rcampbell@...dia.com, willy@...radead.org,
	linux-fsdevel@...r.kernel.org, jack@...e.cz, djwong@...nel.org,
	hch@....de, david@...hat.com, ruansy.fnst@...itsu.com,
	nvdimm@...ts.linux.dev, linux-xfs@...r.kernel.org,
	linux-ext4@...r.kernel.org, jglisse@...hat.com
Subject: Re: [RFC 10/10] mm: Remove pXX_devmap

On Thu, Apr 11, 2024 at 10:57:31AM +1000, Alistair Popple wrote:
> The devmap PTE special bit was used to detect mappings of FS DAX
> pages. This tracking was required to ensure the generic mm did not
> manipulate the page reference counts as FS DAX implemented it's own
> reference counting scheme.
> 
> Now that FS DAX pages have their references counted the same way as
> normal pages this tracking is no longer needed and can be
> removed.
> 
> Almost all existing uses of pmd_devmap() are paired with a check of
> pmd_trans_huge(). As pmd_trans_huge() now returns true for FS DAX pages
> dropping the check in these cases doesn't change anything.
> 
> However care needs to be taken because pmd_trans_huge() also checks that
> a page is not an FS DAX page. This is dealt with either by checking
> !vma_is_dax() or relying on the fact that the page pointer was obtained
> from a page list. This is possible because zone device pages cannot
> appear in any page list due to sharing page->lru with page->pgmap.
> 
> Signed-off-by: Alistair Popple <apopple@...dia.com>
> ---
>  Documentation/mm/arch_pgtable_helpers.rst    |   6 +-
>  arch/arm64/include/asm/pgtable.h             |  24 +---
>  arch/powerpc/include/asm/book3s/64/pgtable.h |  42 +------
>  arch/powerpc/mm/book3s64/hash_pgtable.c      |   3 +-
>  arch/powerpc/mm/book3s64/pgtable.c           |   8 +-
>  arch/powerpc/mm/book3s64/radix_pgtable.c     |   5 +-
>  arch/powerpc/mm/pgtable.c                    |   2 +-
>  arch/x86/include/asm/pgtable.h               |  31 +----
>  fs/dax.c                                     |   5 +-
>  fs/userfaultfd.c                             |   2 +-
>  include/linux/huge_mm.h                      |  10 +-
>  include/linux/mm.h                           |   7 +-
>  include/linux/pgtable.h                      |  17 +--
>  mm/debug_vm_pgtable.c                        |  51 +-------
>  mm/gup.c                                     | 151 +--------------------
>  mm/hmm.c                                     |   5 +-
>  mm/huge_memory.c                             | 100 +-------------
>  mm/khugepaged.c                              |   2 +-
>  mm/mapping_dirty_helpers.c                   |   4 +-
>  mm/memory.c                                  |  25 +---
>  mm/migrate_device.c                          |   2 +-
>  mm/mprotect.c                                |   2 +-
>  mm/mremap.c                                  |   5 +-
>  mm/page_vma_mapped.c                         |   5 +-
>  mm/pgtable-generic.c                         |   7 +-
>  mm/vmscan.c                                  |   5 +-
>  26 files changed, 48 insertions(+), 478 deletions(-)

This is great

I suggest splitting it up into two parts, remove the functional code
in the core mm calling these functions testing and setting pXX_devmap
(and maybe this needs several patches for clarity) and then remove all
the remaining dead code once all the callers are gone.

Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ