linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Hugh Dickins <hugh.dickins@tiscali.co.uk>
To: Eric B Munson <ebmunson@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	akpm@linux-foundation.org, linux-man@vger.kernel.org,
	mtk.manpages@gmail.com, randy.dunlap@oracle.com
Subject: Re: [PATCH 2/3] Add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions
Date: Mon, 31 Aug 2009 20:49:38 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.64.0908312036410.16402@sister.anvils> (raw)
In-Reply-To: <1721a3e8bdf8f311d2388951ec65a24d37b513b1.1251282769.git.ebmunson@us.ibm.com>

On Wed, 26 Aug 2009, Eric B Munson wrote:
> This patch adds a flag for mmap that will be used to request a huge
> page region that will look like anonymous memory to user space.  This
> is accomplished by using a file on the internal vfsmount.  MAP_HUGETLB
> is a modifier of MAP_ANONYMOUS and so must be specified with it.  The
> region will behave the same as a MAP_ANONYMOUS region using small pages.
> 
> Signed-off-by: Eric B Munson <ebmunson@us.ibm.com>
> ---
>  include/asm-generic/mman-common.h |    1 +
>  include/linux/hugetlb.h           |    7 +++++++
>  mm/mmap.c                         |   19 +++++++++++++++++++
>  3 files changed, 27 insertions(+), 0 deletions(-)
> 
> diff --git a/include/asm-generic/mman-common.h b/include/asm-generic/mman-common.h
> index 3b69ad3..12f5982 100644
> --- a/include/asm-generic/mman-common.h
> +++ b/include/asm-generic/mman-common.h
> @@ -19,6 +19,7 @@
>  #define MAP_TYPE	0x0f		/* Mask for type of mapping */
>  #define MAP_FIXED	0x10		/* Interpret addr exactly */
>  #define MAP_ANONYMOUS	0x20		/* don't use a file */
> +#define MAP_HUGETLB	0x40		/* create a huge page mapping */
>  
>  #define MS_ASYNC	1		/* sync memory asynchronously */
>  #define MS_INVALIDATE	2		/* invalidate the caches */

I'm afraid you can't put MAP_HUGETLB in mman-common.h: that is picked
up by most or all architectures (which is of course what you wanted!)
but conflicts with a definition in at least one of them.  When I boot
up mmotm on powerpc, I get a warning:

Using mlock ulimits for SHM_HUGETLB deprecated
------------[ cut here ]------------
Badness at fs/hugetlbfs/inode.c:941
NIP: c0000000001f3038 LR: c0000000001f3034 CTR: 0000000000000000
REGS: c0000000275d7960 TRAP: 0700   Not tainted  (2.6.31-rc7-mm2)
MSR: 9000000000029032 <EE,ME,CE,IR,DR>  CR: 24000484  XER: 00000000
TASK = c000000029fa94a0[1321] 'console-kit-dae' THREAD: c0000000275d4000 CPU: 3
GPR00: c0000000001f3034 c0000000275d7be0 c00000000071a908 0000000000000032 
GPR04: 0000000000000000 ffffffffffffffff ffffffffffffffff 0000000000000000 
GPR08: c0000000297dc1d0 c0000000275d4000 d00008008247fa08 0000000000000000 
GPR12: 0000000024000442 c00000000074ba00 000000000fedb9a4 000000001049cd18 
GPR16: 00000000100365d0 00000000104a9100 000000000fefc350 00000000104a9098 
GPR20: 00000000104a9160 000000000fefc238 0000000000000000 0000000000200000 
GPR24: 0000000000000000 0000000001000000 c0000000275d7d20 0000000001000000 
GPR28: c00000000058c738 ffffffffffffffb5 c0000000006a93d0 c000000000791400 
NIP [c0000000001f3038] .hugetlb_file_setup+0xd0/0x254
LR [c0000000001f3034] .hugetlb_file_setup+0xcc/0x254
Call Trace:
[c0000000275d7be0] [c0000000001f3034] .hugetlb_file_setup+0xcc/0x254 (unreliable)
[c0000000275d7cb0] [c0000000000ee240] .do_mmap_pgoff+0x184/0x424
[c0000000275d7d80] [c00000000000a9c8] .sys_mmap+0xc4/0x13c
[c0000000275d7e30] [c0000000000075ac] syscall_exit+0x0/0x40
Instruction dump:
f89a0000 4bef7111 60000000 2c230000 41820034 e93e8018 80090014 2f800000 
40fe0030 e87e80b0 4823ff09 60000000 <0fe00000> e93e8018 38000001 90090014 

Which won't be coming from any use of MAP_HUGETLB, but presumably
from something using MAP_NORESERVE, defined as 0x40 in
arch/powerpc/include/asm/mman.h.

I think you have to put your #define MAP_HUGETLB into
include/asm-generic/mman.h (seems used by only three architectures),
and into the arch/whatever/include/asm/mman.h of each architecture
which uses asm-generic/mman-common.h without asm-generic/mman.h.

Hugh

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2009-08-31 19:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-26 10:44 [PATCH 0/3] Add pseudo-anonymous huge page mappings V4 Eric B Munson
2009-08-26 10:44 ` [PATCH 1/3] hugetlbfs: Allow the creation of files suitable for MAP_PRIVATE on the vfs internal mount Eric B Munson
2009-08-26 10:44   ` [PATCH 2/3] Add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions Eric B Munson
2009-08-26 10:44     ` [PATCH 3/3] Add MAP_HUGETLB example Eric B Munson
2009-08-31 19:49     ` Hugh Dickins [this message]
2009-09-01  9:46       ` [PATCH 2/3] Add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions Eric B Munson
2009-09-01 10:41         ` Hugh Dickins
2009-09-01 13:08           ` Eric B Munson
2009-09-01 13:34             ` Hugh Dickins
2009-09-02  8:34               ` Arnd Bergmann
2009-09-09  9:16       ` [PATCH] MAP_HUGETLB value collision fix Eric B Munson
2009-09-15 10:46       ` [PATCH] Fix for hugetlb-add-map_hugetlb-for-mmaping-pseudo-anonymous-huge-page-regions.patch in -mm Eric B Munson
2009-09-15 20:53         ` Hugh Dickins
2010-02-08 22:56           ` Randy Dunlap
2010-02-09 15:01             ` Arnd Bergmann
2009-09-02 12:15     ` [PATCH] MAP_HUGETLB value collision fix Eric B Munson
2009-08-27 14:18   ` [PATCH 1/3] hugetlbfs: Allow the creation of files suitable for MAP_PRIVATE on the vfs internal mount Mel Gorman
2009-08-27 15:11     ` Eric B Munson
  -- strict thread matches above, loose matches on Subject: below --
2009-08-25 11:14 [PATCH 0/3] Add pseudo-anonymous huge page mappings V4 Eric B Munson
2009-08-25 11:14 ` [PATCH 1/3] hugetlbfs: Allow the creation of files suitable for MAP_PRIVATE on the vfs internal mount Eric B Munson
2009-08-25 11:14   ` [PATCH 2/3] Add MAP_HUGETLB for mmaping pseudo-anonymous huge page regions Eric B Munson
2009-09-17 22:44     ` Andrew Morton
2009-09-18  0:46       ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0908312036410.16402@sister.anvils \
    --to=hugh.dickins@tiscali.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=ebmunson@us.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-man@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mtk.manpages@gmail.com \
    --cc=randy.dunlap@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox