All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Hillf Danton <dhillf@gmail.com>
Subject: Re: [PATCH] MM: Support more pagesizes for MAP_HUGETLB/SHM_HUGETLB v6
Date: Mon, 22 Oct 2012 15:56:13 +0200	[thread overview]
Message-ID: <CAKgNAkgQ6JZdwOsCAQ4Ak_gVXtav=TzgzW2tbk5jMUwxtMqOAg@mail.gmail.com> (raw)
In-Reply-To: <20121022133534.GR16230@one.firstfloor.org>

On Mon, Oct 22, 2012 at 3:35 PM, Andi Kleen <andi@firstfloor.org> wrote:
> On Mon, Oct 22, 2012 at 03:27:33PM +0200, Andi Kleen wrote:
>> > Maybe I am missing something obvious, but does this not conflict with
>> > include/uapi/asm-generic/mman-common.h:
>> >
>> > #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
>> > # define MAP_UNINITIALIZED 0x4000000
>> > ...
>> >
>> > 0x4000000 == (1 << 26
>> >
>>
>> You're right. Someone added that since I wrote the patch originally.
>> I owned them when originally submitted @) Thanks for catching.
>>
>> Have to move my bits two up, which will still work, but limit the
>
> Two up won't work, need one up.
>
> 32..28 = 16  is too small for 2^30 = 1GB pages
> 32..27 = 32  max 4GB pages

Not sure of your notation there. I assume 31..27 means 5 bits (32
through to 28 inclusive, 27 excluded). That gives you just 2^31 ==
2GB, not 4GB (unless your planning to always add 1 to the value in
those bits, since a value of zero has little meaning).

But there seems an obvious solution here: given your value in those
bits (call it 'n'), the why not apply a multiplier. I mean, certainly
you never want a value <= 12 for n, and I suspect that the reasonable
minimum could be much larger (e.g., 2^16). Call that minimum M. Then
you could interpret the value in your bits as meaning a page size of

    (2^n) * M

> So this will use up all remaining flag bits now.

On the other hand, that seems really bad. It looks like that kills the
ability to further extend the mmap() API with new flags in the future.
It doesn't sound like we should be doing that.

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/

WARNING: multiple messages have this Message-ID (diff)
From: "Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>
To: Andi Kleen <andi@firstfloor.org>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, Andi Kleen <ak@linux.intel.com>,
	Hillf Danton <dhillf@gmail.com>
Subject: Re: [PATCH] MM: Support more pagesizes for MAP_HUGETLB/SHM_HUGETLB v6
Date: Mon, 22 Oct 2012 15:56:13 +0200	[thread overview]
Message-ID: <CAKgNAkgQ6JZdwOsCAQ4Ak_gVXtav=TzgzW2tbk5jMUwxtMqOAg@mail.gmail.com> (raw)
In-Reply-To: <20121022133534.GR16230@one.firstfloor.org>

On Mon, Oct 22, 2012 at 3:35 PM, Andi Kleen <andi@firstfloor.org> wrote:
> On Mon, Oct 22, 2012 at 03:27:33PM +0200, Andi Kleen wrote:
>> > Maybe I am missing something obvious, but does this not conflict with
>> > include/uapi/asm-generic/mman-common.h:
>> >
>> > #ifdef CONFIG_MMAP_ALLOW_UNINITIALIZED
>> > # define MAP_UNINITIALIZED 0x4000000
>> > ...
>> >
>> > 0x4000000 == (1 << 26
>> >
>>
>> You're right. Someone added that since I wrote the patch originally.
>> I owned them when originally submitted @) Thanks for catching.
>>
>> Have to move my bits two up, which will still work, but limit the
>
> Two up won't work, need one up.
>
> 32..28 = 16  is too small for 2^30 = 1GB pages
> 32..27 = 32  max 4GB pages

Not sure of your notation there. I assume 31..27 means 5 bits (32
through to 28 inclusive, 27 excluded). That gives you just 2^31 ==
2GB, not 4GB (unless your planning to always add 1 to the value in
those bits, since a value of zero has little meaning).

But there seems an obvious solution here: given your value in those
bits (call it 'n'), the why not apply a multiplier. I mean, certainly
you never want a value <= 12 for n, and I suspect that the reasonable
minimum could be much larger (e.g., 2^16). Call that minimum M. Then
you could interpret the value in your bits as meaning a page size of

    (2^n) * M

> So this will use up all remaining flag bits now.

On the other hand, that seems really bad. It looks like that kills the
ability to further extend the mmap() API with new flags in the future.
It doesn't sound like we should be doing that.

Cheers,

Michael

-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Author of "The Linux Programming Interface"; http://man7.org/tlpi/

--
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>

  reply	other threads:[~2012-10-22 13:56 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 16:48 [PATCH] MM: Support more pagesizes for MAP_HUGETLB/SHM_HUGETLB v6 Andi Kleen
2012-10-19 16:48 ` Andi Kleen
2012-10-20  3:39 ` Hillf Danton
2012-10-20  3:39   ` Hillf Danton
2012-10-22 11:27 ` Michael Kerrisk
2012-10-22 11:27   ` Michael Kerrisk
2012-10-22 13:27   ` Andi Kleen
2012-10-22 13:27     ` Andi Kleen
2012-10-22 13:35     ` Andi Kleen
2012-10-22 13:35       ` Andi Kleen
2012-10-22 13:56       ` Michael Kerrisk (man-pages) [this message]
2012-10-22 13:56         ` Michael Kerrisk (man-pages)
2012-10-22 15:36         ` Andi Kleen
2012-10-22 15:36           ` Andi Kleen
2012-10-22 15:53           ` Michael Kerrisk (man-pages)
2012-10-22 15:53             ` Michael Kerrisk (man-pages)
2012-10-22 16:11             ` Andi Kleen
2012-10-22 16:11               ` Andi Kleen
2012-10-22 16:23               ` Michael Kerrisk (man-pages)
2012-10-22 16:23                 ` Michael Kerrisk (man-pages)
2012-10-22 16:29                 ` Andi Kleen
2012-10-22 16:29                   ` Andi Kleen
2012-10-22 16:42                   ` Michael Kerrisk (man-pages)
2012-10-22 16:42                     ` Michael Kerrisk (man-pages)
2012-10-23  1:45                 ` Benjamin Herrenschmidt
2012-10-23  1:45                   ` Benjamin Herrenschmidt
2012-10-23  1:44             ` Benjamin Herrenschmidt
2012-10-23  1:44               ` Benjamin Herrenschmidt
2012-10-23  2:28               ` Andi Kleen
2012-10-23  2:28                 ` Andi Kleen
2012-10-23  7:37                 ` Michael Kerrisk (man-pages)
2012-10-23  7:37                   ` Michael Kerrisk (man-pages)
2012-10-23 13:39                   ` Andi Kleen
2012-10-23 13:39                     ` Andi Kleen
2012-10-23 22:56           ` Valdis.Kletnieks
2012-10-22 21:39     ` Andrew Morton
2012-10-22 21:39       ` 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='CAKgNAkgQ6JZdwOsCAQ4Ak_gVXtav=TzgzW2tbk5jMUwxtMqOAg@mail.gmail.com' \
    --to=mtk.manpages@gmail.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=dhillf@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.