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]
Date:   Tue, 12 Apr 2022 10:47:20 +0200
From:   Vlastimil Babka <vbabka@...e.cz>
To:     David Hildenbrand <david@...hat.com>, linux-kernel@...r.kernel.org
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Hugh Dickins <hughd@...gle.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        David Rientjes <rientjes@...gle.com>,
        Shakeel Butt <shakeelb@...gle.com>,
        John Hubbard <jhubbard@...dia.com>,
        Jason Gunthorpe <jgg@...dia.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Mike Rapoport <rppt@...ux.ibm.com>,
        Yang Shi <shy828301@...il.com>,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        Matthew Wilcox <willy@...radead.org>,
        Jann Horn <jannh@...gle.com>, Michal Hocko <mhocko@...nel.org>,
        Nadav Amit <namit@...are.com>, Rik van Riel <riel@...riel.com>,
        Roman Gushchin <guro@...com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Peter Xu <peterx@...hat.com>,
        Donald Dutile <ddutile@...hat.com>,
        Christoph Hellwig <hch@....de>,
        Oleg Nesterov <oleg@...hat.com>, Jan Kara <jack@...e.cz>,
        Liang Zhang <zhangliang5@...wei.com>,
        Pedro Gomes <pedrodemargomes@...il.com>,
        Oded Gabbay <oded.gabbay@...il.com>, linux-mm@...ck.org
Subject: Re: [PATCH v3 08/16] mm/rmap: drop "compound" parameter from
 page_add_new_anon_rmap()

On 3/29/22 18:04, David Hildenbrand wrote:
> New anonymous pages are always mapped natively: only THP/khugepagd code

						khugepaged ^

> maps a new compound anonymous page and passes "true". Otherwise, we're
> just dealing with simple, non-compound pages.
> 
> Let's give the interface clearer semantics and document these.
> 
> Signed-off-by: David Hildenbrand <david@...hat.com>

Acked-by: Vlastimil Babka <vbabka@...e.cz>

Nit:

> --- a/mm/rmap.c
> +++ b/mm/rmap.c
> @@ -1182,19 +1182,22 @@ void page_add_anon_rmap(struct page *page,
>  }
>  
>  /**
> - * page_add_new_anon_rmap - add pte mapping to a new anonymous page
> + * page_add_new_anon_rmap - add mapping to a new anonymous page
>   * @page:	the page to add the mapping to
>   * @vma:	the vm area in which the mapping is added
>   * @address:	the user virtual address mapped
> - * @compound:	charge the page as compound or small page
> + *
> + * If it's a compound page, it is accounted as a compound page. As the page
> + * is new, it's assume to get mapped exclusively by a single process.
>   *
>   * Same as page_add_anon_rmap but must only be called on *new* pages.
>   * This means the inc-and-test can be bypassed.
>   * Page does not have to be locked.
>   */
>  void page_add_new_anon_rmap(struct page *page,
> -	struct vm_area_struct *vma, unsigned long address, bool compound)
> +	struct vm_area_struct *vma, unsigned long address)
>  {
> +	const bool compound = PageCompound(page);
>  	int nr = compound ? thp_nr_pages(page) : 1;
>  
>  	VM_BUG_ON_VMA(address < vma->vm_start || address >= vma->vm_end, vma);

There's a VM_BUG_ON_PAGE(PageTransCompound(page), page); later in a
!compound branch. Since compound is now determined by the same check, could
be deleted.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ