kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: sebastian@pipping.org (Sebastian Pipping)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Question on mmap / expecting more calls to vfs_read
Date: Fri, 07 Jan 2011 00:49:25 +0100	[thread overview]
Message-ID: <4D265505.3070500@pipping.org> (raw)
In-Reply-To: <AANLkTinjJ_jQNa5US9g_phwcRdnSZJymRJ00rAutB5Lz@mail.gmail.com>

On 01/06/11 07:53, Rajat Sharma wrote:
> Hi Sebastian,
> 
> you guess for ELF header seems to be valid to me. When executables or
> binaries are loaded memory, it is done through mmap call to the file,
> and to understand what file is and what binary handler in kernel can
> handle its section, kernel needs to know its header first, which is
> within the first page of the header with fixed location for a magic
> number (identifier for binary handler e.g. ELF handler which further
> loads its other sections by reading section table). Note that there
> are multiple binary format handles within the kernel e.g. ELF, A.OUT
> which are tried sequentially to identify the file format.
> 
> From the file system perspective, mmap does not use vfs_read or
> vfs_write calls at all, thats why you don't see them. It directly
> works on address space operations of an inode (file) to populate data
> in page-cache. For a mmapped region, if you don't see a page in
> memory, kenel page faults and tries to read-in the page using readpage
> method of address_space_operations. Similarly when you modify a page,
> writepage method is called, but since executables are accessed
> read-only, you won't see writepage method getting called either.
> 
> Hope this makes it clearer.

Excellent, thank you!  I find calls to readpages on file
/lib/libc-2.11.2.so now.  That may be the missing reads.

Any ideas how get offset and length (like with vfs_read) for a certain
page passed to readpage(file, page) ?

Best,



Sebastian

  reply	other threads:[~2011-01-06 23:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-05 20:16 Question on mmap / expecting more calls to vfs_read Sebastian Pipping
2011-01-05 22:15 ` Mulyadi Santosa
2011-01-06  6:53   ` Rajat Sharma
2011-01-06 23:49     ` Sebastian Pipping [this message]
2011-01-07  0:09       ` Manish Katiyar
2011-01-07  6:26         ` Rajat Sharma
2011-01-07  6:30           ` Rajat Sharma
2011-01-11 19:16           ` Sebastian Pipping
2011-01-12  5:12             ` Rajat Sharma

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=4D265505.3070500@pipping.org \
    --to=sebastian@pipping.org \
    --cc=kernelnewbies@lists.kernelnewbies.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).