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: <57193658.9020803@oracle.com>
Date:	Thu, 21 Apr 2016 13:21:44 -0700
From:	Mike Kravetz <mike.kravetz@...cle.com>
To:	Matthew Wilcox <willy@...ux.intel.com>,
	Toshi Kani <toshi.kani@....com>
Cc:	Jan Kara <jack@...e.cz>, linux-nvdimm@...1.01.org,
	david@...morbit.com, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org, adilger.kernel@...ger.ca,
	viro@...iv.linux.org.uk, linux-fsdevel@...r.kernel.org,
	tytso@....edu, Andrew Morton <akpm@...ux-foundation.org>,
	kirill.shutemov@...ux.intel.com
Subject: Re: [PATCH v3 0/2] Align mmap address for DAX pmd mappings

On 04/21/2016 12:06 AM, Matthew Wilcox wrote:
> On Wed, Apr 20, 2016 at 11:10:25PM -0400, Toshi Kani wrote:
>> How about moving the function (as is) to mm/huge_memory.c, rename it to
>> get_hugepage_unmapped_area(), which is defined to NULL in huge_mm.h
>> when TRANSPARENT_HUGEPAGE is unset?
> 
> Great idea.  Perhaps it should look something like this?
> 
> unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr,
>                 unsigned long len, unsigned long pgoff, unsigned long flags)
> {

Might want to keep the future possibility of PUD_SIZE THP in mind?
-- 
Mike Kravetz

>         loff_t off, off_end, off_pmd;
>         unsigned long len_pmd, addr_pmd;
> 
>         if (addr)
>                 goto out;
>         if (IS_DAX(filp->f_mapping->host) && !IS_ENABLED(CONFIG_FS_DAX_PMD))
>                 goto out;
>         /* Kirill, please fill in the right condition here for THP pagecache */
> 
>         off = (loff_t)pgoff << PAGE_SHIFT;
>         off_end = off + len;
>         off_pmd = round_up(off, PMD_SIZE);      /* pmd-aligned start offset */
> 
>         if ((off_end <= off_pmd) || ((off_end - off_pmd) < PMD_SIZE))
>                 goto out;
> 
>         len_pmd = len + PMD_SIZE;
>         if ((off + len_pmd) < off)
>                 goto out;
> 
>         addr_pmd = current->mm->get_unmapped_area(filp, NULL, len_pmd,
>                                                 pgoff, flags);
>         if (!IS_ERR_VALUE(addr_pmd)) {
>                 addr_pmd += (off - addr_pmd) & (PMD_SIZE - 1);
>                 return addr_pmd;
>         }
>  out:
>         return current->mm->get_unmapped_area(filp, addr, len, pgoff, flags);
> }
> 
>  - I deleted the check for filp == NULL.  It can't be NULL ... this is a
>    file_operation ;-)
>  - Why is len_pmd len + PMD_SIZE instead of round_up(len, PMD_SIZE)?
>  - I'm still in two minds about passing 'addr' to the first call to
>    get_unmapped_area() instead of NULL.
> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@...ts.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ