linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: "linux-mm@kvack.org" <linux-mm@kvack.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Cc: Michal Hocko <mhocko@suse.com>,
	Oscar Salvador <osalvador@suse.de>,
	David Hildenbrand <david@redhat.com>,
	Naoya Horiguchi <naoya.horiguchi@linux.dev>,
	Hugh Dickins <hughd@google.com>, Peter Xu <peterx@redhat.com>
Subject: vma_needs_copy always true for VM_HUGETLB ?
Date: Wed, 18 May 2022 15:36:30 -0700	[thread overview]
Message-ID: <a7ccd8b2-c659-44c9-cb18-1496f99aa5a8@oracle.com> (raw)

For most non-anonymous vmas, we do not copy page tables at fork time, but
rather lazily populate the tables after fork via faults.  The routine
vma_needs_copy() is used to make this decision. For VM_HUGETLB vmas, it always
returns true.

Anyone know/remember why?  The code was added more than 15 years ago and
my search for why hugetlb vmas were excluded came up empty.

I do not see a reason why VM_HUGETLB is in this list.  Initial testing did
not reveal any problems when I removed the VM_HUGETLB check.

FYI - I am looking at the performance of fork and exec (unmap) of processes
with very large hugetlb mappings.  Skipping the copy at fork time would
certainly speed things up.  Of course, there could some users who would
notice if hugetlb page tables are not copied at fork time.  However, this
is the behavior for 'normal' mappings.  I am inclined to make hugetlb be
'more normal'.
-- 
Mike Kravetz


             reply	other threads:[~2022-05-18 22:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 22:36 Mike Kravetz [this message]
2022-05-19  1:30 ` Hugh Dickins
2022-05-19  3:36   ` Mike Kravetz

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=a7ccd8b2-c659-44c9-cb18-1496f99aa5a8@oracle.com \
    --to=mike.kravetz@oracle.com \
    --cc=david@redhat.com \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=naoya.horiguchi@linux.dev \
    --cc=osalvador@suse.de \
    --cc=peterx@redhat.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