From: "'David Gibson'" <david@gibson.dropbear.id.au>
To: "Chen, Kenneth W" <kenneth.w.chen@intel.com>
Cc: "'Zhang, Yanmin'" <yanmin_zhang@linux.intel.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ftruncate on huge page couldn't extend hugetlb file
Date: Thu, 9 Mar 2006 12:03:14 +1100 [thread overview]
Message-ID: <20060309010314.GG17590@localhost.localdomain> (raw)
In-Reply-To: <200603090033.k290XBg13472@unix-os.sc.intel.com>
On Wed, Mar 08, 2006 at 04:33:10PM -0800, Chen, Kenneth W wrote:
> David Gibson wrote on Wednesday, March 08, 2006 4:23 PM
> > > But you already make reservation at mmap time. If you reserve it again
> > > when extending the file, won't you double count?
> >
> > Well, I'd generally expect extending truncate() to come before mmap(),
> > but in any case hugetlb_extend_reservation() is safe against double
> > counting (it's idempotent if called twice with the same number of
> > pages). The semantics are "ensure the this many pages total are
> > guaranteed available, that is, either reserved or already
> > instantiated".
>
> It's kind of peculiar that kernel reserve hugetlb page at the time of
> extending truncate. Maybe there is a close correlation between mmap
> size to the file size. But these two aren't the same and and shouldn't
> be mixed.
Indeed. The fundamental basis of my approach as opposed to that in
apw's old accounting patches is that reservation is related to
filesize, not mmap() size. The only connection to mmap() is that
(shared writable) mmap() on hugetlbfs also extends filesize and
reservation size as a side effect.
There's a slight wrinkle in the different between i_size and reserved
pages. i_size can be extended beyond the "reserved portion" of the
file. We need that behaviour because i_size also acts as a hard
offset limit for MAP_PRIVATE mappings, but privately instantiated
pages don't come from the file's reservation.
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
next prev parent reply other threads:[~2006-03-09 1:03 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-06 6:21 [PATCH] hugetlb_no_page might break hugetlb quota Zhang, Yanmin
2006-03-06 8:15 ` Chen, Kenneth W
2006-03-06 9:06 ` Zhang, Yanmin
2006-03-08 3:14 ` Zhang, Yanmin
2006-03-08 3:24 ` [PATCH] ftruncate on huge page couldn't extend hugetlb file Zhang, Yanmin
[not found] ` <20060307222148.76e5dc45.akpm@osdl.org>
2006-03-08 6:54 ` Zhang, Yanmin
2006-03-08 18:28 ` Chen, Kenneth W
2006-03-08 23:58 ` David Gibson
2006-03-09 0:12 ` Chen, Kenneth W
2006-03-09 0:22 ` 'David Gibson'
2006-03-09 0:33 ` Chen, Kenneth W
2006-03-09 1:03 ` 'David Gibson' [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-03-08 19:03 Chen, Kenneth W
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=20060309010314.GG17590@localhost.localdomain \
--to=david@gibson.dropbear.id.au \
--cc=kenneth.w.chen@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=yanmin_zhang@linux.intel.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