I have also tested using this loop.  For a reasonably large file being read,
using the loop executes 300k fewer simulated instructions (~6% of the
readfile execution) than using memset.  On the other hand, the simulation
time of the readfile call using memset was actually 0.4s quicker (~5%) than
using the loop.  The simulated system still needs to do a pagetable walk and
mapping for each page regardless of the implementation.  So, my conclusion
was that it doesn't make a perceptible difference in performance, and the
use of memset abstracts away from possible problems with strided accesses
using a static page size.

  Joel


On Mon, Aug 9, 2010 at 12:50 PM, Ali Saidi <sa...@umich.edu> wrote:

>
>
> > On 2010-08-09 12:13:59, Nathan Binkert wrote:
> > >
>
> How is this not a possible issue for every isa? We're talking about
> touching 256kB of data. That shouldn't take very long. We've beaten this to
> death, it's time to just call it done and move on. If we're that concerned
> just do:
> for (int x = 0; x < sizeof(buf); x += 512)
>    buf[x] = 0;
>
> It improves the speed by three orders of magnitude, doesn't require and
> ifdef and will work on everything that doesn't have a unbelievably small
> page size.
>
>
> - Ali
>
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://reviews.m5sim.org/r/121/#review154
> -----------------------------------------------------------
>
>
> On 2010-08-09 10:35:49, Joel Hestness wrote:
> >
> > -----------------------------------------------------------
> > This is an automatically generated e-mail. To reply, visit:
> > http://reviews.m5sim.org/r/121/
> > -----------------------------------------------------------
> >
> > (Updated 2010-08-09 10:35:49)
> >
> >
> > Review request for Default.
> >
> >
> > Summary
> > -------
> >
> > util/m5/m5.c: in readfile(), added memset to touch all pages - ensure
> they are in the page table
> >
> > This problem is caused by Linux demand paging.  If the pages are not yet
> mapped in the page table, the M5 utility does not know the physical memory
> address in the simulated system to which it is sending the file read from
> the host machine.
> >
> >
> > Diffs
> > -----
> >
> >   util/m5/m5.c a75564db03c3
> >
> > Diff: http://reviews.m5sim.org/r/121/diff
> >
> >
> > Testing
> > -------
> >
> > This fixes the functionality for x86, where the problem was first
> encountered.  I have also tested the utility for Alpha.  The simulated
> system executes approximately 10% more instructions during the readfile
> operation due to the memset, but the simulation time required for this is
> still marginal.  Using memset provides an ISA independent solution compared
> to buffer accesses that use a page-sized stride.
> >
> >
> > Thanks,
> >
> > Joel
> >
> >
>



-- 
  Joel Hestness
  PhD Student, Computer Architecture
  Dept. of Computer Science, University of Texas - Austin
  http://www.cs.utexas.edu/~hestness
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to