On Thu, Jan 6, 2011 at 3:49 PM, Sebastian Pipping <sebastian@xxxxxxxxxxx> wrote: > 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) ? Add your stats hooks to do_mmap or mmap_region() ??? -- Thanks - Manish ================================== [$\*.^ -- I miss being one of them ================================== _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies