linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peng Liang <liangpeng10@huawei.com>
To: <linux-kernel@vger.kernel.org>
Cc: <linux-mm@kvack.org>, <hughd@google.com>,
	<akpm@linux-foundation.org>,
	xiexiangyou 00584000 <xiexiangyou@huawei.com>,
	zhengchuan <zhengchuan@huawei.com>, <wanghao232@huawei.com>,
	chenwandun 00417970 <chenwandun@huawei.com>
Subject: Questions about page fault of memfd/shmem
Date: Sat, 27 Nov 2021 17:19:41 +0800	[thread overview]
Message-ID: <8ddeff27-267b-bc87-1061-9e7946fe9b42@huawei.com> (raw)

Hi all,

I'm a user-space developer and I want to use memfd to share some memory
between parent and child processes.

For the demo, it works well.  However, I fount that the RSS of the
process using memfd will grow up faster than that using anonymous
mappings.  Dig some memfd/shmem code and I find that memfd/shmem will
allocate a page for a read page fault.

For my use case, the process may allocate tens or even hundreds of GiB
memory using memfd.  So allocating all memory just because of reading it
will has a great impact.

Could memfd/shmem map to the global zero page instead of allocating a
page for a read page fault?

Thanks,
Peng


                 reply	other threads:[~2021-11-27  9:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=8ddeff27-267b-bc87-1061-9e7946fe9b42@huawei.com \
    --to=liangpeng10@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=chenwandun@huawei.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=wanghao232@huawei.com \
    --cc=xiexiangyou@huawei.com \
    --cc=zhengchuan@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