public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Joel Savitz <jsavitz@redhat.com>, linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@kernel.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mauro Carvalho Chehab <mchehab+samsung@kernel.org>,
	Kristina Martsenko <kristina.martsenko@arm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Cyrill Gorcunov <gorcunov@gmail.com>,
	Kees Cook <keescook@chromium.org>,
	"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
	YueHaibing <yuehaibing@huawei.com>,
	Micah Morton <mortonm@chromium.org>,
	Yang Shi <yang.shi@linux.alibaba.com>,
	Jann Horn <jannh@google.com>,
	Alexey Dobriyan <adobriyan@gmail.com>,
	Rafael Aquini <aquini@redhat.com>,
	Michael Kerrisk <mtk.manpages@gmail.com>,
	Yury Norov <norov.maillist@gmail.com>
Subject: Re: [PATCH v2 0/2] sys/prctl: expose TASK_SIZE value to userspace
Date: Thu, 2 May 2019 17:01:38 -0400	[thread overview]
Message-ID: <8bb9fe29-65d3-e977-1932-4a2f17ead333@redhat.com> (raw)
In-Reply-To: <1556830342-32307-1-git-send-email-jsavitz@redhat.com>

On 5/2/19 4:52 PM, Joel Savitz wrote:
> In the mainline kernel, there is no quick mechanism to get the virtual
> memory size of the current process from userspace.
>
> Despite the current state of affairs, this information is available to the
> user through several means, one being a linear search of the entire address
> space. This is an inefficient use of cpu cycles.
>
> A component of the libhugetlb kernel test does exactly this, and as
> systems' address spaces increase beyond 32-bits, this method becomes
> exceedingly tedious.
>
> For example, on a ppc64le system with a 47-bit address space, the linear
> search causes the test to hang for some unknown amount of time. I
> couldn't give you an exact number because I just ran it for about 10-20
> minutes and went to go do something else, probably to get coffee or
> something, and when I came back, I just killed the test and patched it
> to use this new mechanism. I re-ran my new version of the test using a
> kernel with this patch, and of course it passed through the previously
> bottlenecking codepath nearly instantaneously.
>
> As such, I propose that the prctl syscall be extended to include the
> option to retrieve TASK_SIZE from the kernel.
>
> This patch will allow us to upgrade an O(n) codepath to O(1) in an
> architecture-independent manner, and provide a mechanism for others
> to do the same.
>
> Joel Savitz(2):
>   sys/prctl: add PR_GET_TASK_SIZE option to prctl(2)
>   prctl.2: Document the new PR_GET_TASK_SIZE option
>
>  include/uapi/linux/prctl.h |  3 +++
>  kernel/sys.c               | 10 ++++++++++
>  2 files changed, 13 insertions(+)
>
>  man2/prctl.2 | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> --
> 2.18.1

What did you change in v2 versus v1?

Cheers,
Longman


  parent reply	other threads:[~2019-05-02 21:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-02 20:52 [PATCH v2 0/2] sys/prctl: expose TASK_SIZE value to userspace Joel Savitz
2019-05-02 20:52 ` [PATCH v2 1/2] kernel/sys: add PR_GET_TASK_SIZE option to prctl(2) Joel Savitz
2019-05-02 21:09   ` Cyrill Gorcunov
2019-05-02 21:46     ` Joel Savitz
2019-05-03  8:31       ` Cyrill Gorcunov
2019-05-03 11:31         ` David Laight
2019-05-02 21:24   ` Rafael Aquini
2019-05-02 21:49   ` Yury Norov
2019-05-02 20:52 ` [PATCH v2 2/2] prctl.2: Document the new PR_GET_TASK_SIZE option Joel Savitz
2019-05-02 22:23   ` Yury Norov
2019-05-03  1:49     ` Rafael Aquini
2019-05-02 21:01 ` Waiman Long [this message]
2019-05-02 21:10   ` [PATCH v2 0/2] sys/prctl: expose TASK_SIZE value to userspace Cyrill Gorcunov
2019-05-02 21:22     ` Joel Savitz
2019-05-02 21:34       ` Yury Norov
2019-05-02 21:26 ` Rafael Aquini

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=8bb9fe29-65d3-e977-1932-4a2f17ead333@redhat.com \
    --to=longman@redhat.com \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aquini@redhat.com \
    --cc=gorcunov@gmail.com \
    --cc=gustavo@embeddedor.com \
    --cc=jannh@google.com \
    --cc=jsavitz@redhat.com \
    --cc=keescook@chromium.org \
    --cc=kristina.martsenko@arm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab+samsung@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=mortonm@chromium.org \
    --cc=mtk.manpages@gmail.com \
    --cc=norov.maillist@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=yang.shi@linux.alibaba.com \
    --cc=yuehaibing@huawei.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