linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: aglitke <agl@us.ibm.com>
To: Ken Chen <kenchen@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>, linux-mm <linux-mm@kvack.org>
Subject: Re: [patch] hugetlb: fix i_blocks accounting
Date: Fri, 09 Nov 2007 12:09:57 -0600	[thread overview]
Message-ID: <1194631797.14675.49.camel@localhost.localdomain> (raw)
In-Reply-To: <b040c32a0711090942x45e89356kcc7d3282b2dedcb2@mail.gmail.com>

Thanks for that explanation.  It makes complete sense to me now.

On Fri, 2007-11-09 at 09:42 -0800, Ken Chen wrote:
> On Nov 9, 2007 6:17 AM, aglitke <agl@us.ibm.com> wrote:
> > > diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h
> > > index 770dbed..65371bd 100644
> > > --- a/include/linux/hugetlb.h
> > > +++ b/include/linux/hugetlb.h
> > > @@ -168,6 +168,8 @@ struct file *hugetlb_file_setup(const char *name, size_t);
> > >  int hugetlb_get_quota(struct address_space *mapping, long delta);
> > >  void hugetlb_put_quota(struct address_space *mapping, long delta);
> > >
> > > +#define BLOCKS_PER_HUGEPAGE  (HPAGE_SIZE / 512)
> >
> > Sorry if this is an obvious question, but where does 512 above come
> > from?
> 
> out of stat(2) man page:
> 
> The st_blocks field indicates the number of blocks allocated to the
> file,  512-byte
> units.   (This  may  be  smaller  than  st_size/512, for example, when
> the file has
> holes.)
> 
> I looked at what other fs do with the i_blocks field (ext2, tmpfs),
> they all follow the above convention, regardless what the underlying
> fs block size is or arch page size.
> 
> > Is this just establishing a new convention that a block is equal
> > to 1/512th of whatever size a huge page happens to be?
> 
> I'm trying to be consistent with other fs.
> 
> > What about on
> > ia64 where the hugepage size is set at boot?  Wouldn't that be confusing
> > to have the block size change between boots?  What if we just make the
> > block size equal to PAGE_SIZE (which is a more stable quantity)?
> 
> It shouldn't matter, as there is another field st_blksize which
> indicate block size for the filesystem.  i_blocks is just an
> accounting on number of blocks allocated and it appears to me that it
> was intentionally set to 512 byte unit in the man page (to cut down
> confusion?  I have no idea).
> 
> - Ken
> 
-- 
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center

--
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:[~2007-11-09 18:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b040c32a0711082343t2b94b495r1608d99ec0e28a4c@mail.gmail.com>
2007-11-09 17:31 ` [patch] hugetlb: fix i_blocks accounting Ken Chen
     [not found] ` <1194617837.14675.45.camel@localhost.localdomain>
2007-11-09 17:42   ` Ken Chen
2007-11-09 18:09     ` aglitke [this message]
2007-11-10  1:16       ` Andrew Morton
2007-11-10  1:34         ` Ken Chen
2007-11-12 14:53           ` aglitke
2007-10-20 18:18 Ken Chen
2007-10-23 14:52 ` Adam Litke
2007-10-24  0:34   ` Ken Chen
2007-10-24 13:06     ` Adam Litke

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=1194631797.14675.49.camel@localhost.localdomain \
    --to=agl@us.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=kenchen@google.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).