Commit Graph

35 Commits (master)

Author SHA1 Message Date
Shuxin Yang 6821a07f94 o. Add testing cases for
c1) lazily call lm_init*()
    c2) the hybrid-mode which prefer calling mmap(2) to calling user-mode lm_mmap().
    c3) the user-mode which exclusively call lm_mmap()

o. fix a bug about c1) mentioned above
2014-12-11 11:49:06 -08:00
Shuxin Yang 43cc26020a Add one system-mode testing case.
Fix bunch of minior bugs exposed by this testing case.
2014-12-09 13:23:07 -08:00
Shuxin Yang c3e010b11f Capitalize mode enum value 2014-12-09 10:22:37 -08:00
Shuxin Yang 839698668b fix trailing whitespace 2014-12-06 18:09:06 -08:00
Shuxin Yang 79e6c1a006 correct the macro SIZE_2GB which was actually 1GB 2014-12-06 17:55:33 -08:00
Shuxin Yang af14dd83d6 Fix a problem in make recipe. The recipe used to have only one
target, so $@ is working fine for specifying the target.
I added another target to the recipe but forgot change $@
accordingly.

Thank Yichun for figuring out this problem.
2014-12-06 17:54:27 -08:00
Shuxin Yang 8259273340 o. clean up.
o. add support multiple-mode support: user mode mmap, kernel mode mmap, hybrid modes.
2014-12-06 11:46:44 -08:00
Shuxin Yang ac0c71a86b Add a testing test for the bug fixed in e0e0d1e006 2014-12-05 12:03:33 -08:00
Shuxin Yang e0e0d1e006 Fix a bug in ljmm_mremap().
The bug is triggered when ljmm_mremap() tries to shrink the
a mmapped block. The problem is about mistakenly calculating
the starting address of the stretch of memory that is going
to be disposed.

The unit testing suite does not have a case to catch the
memory shrinking. I will add a testing case tomorrow.
2014-12-04 23:18:11 -08:00
Shuxin Yang 0503a7fa1c Initialize variable "finalize" to 1. We would otherwise
call finalizer function even if it is not initialized.
2014-12-03 21:33:36 -08:00
Shuxin Yang 44674a216b add .gitignore 2014-12-03 16:19:31 -08:00
Shuxin Yang a686bbd9c3 Link objects together via "ld -r", and the resulting combined *.o can be directly linked
to luajit.
2014-12-03 15:52:55 -08:00
Shuxin Yang 8ec9bdad27 Add comment; correct comment; all about comment. 2014-10-28 11:31:01 -07:00
Shuxin Yang 7dbfb668f1 Fix bunch of bugs!
As of this revision. We are able to run CPU2000int with refernece input
successfully! These benchmarks are linked against ptmalloc3 (not part of
this project) and the libadaptor.so.

Running CPU2000int is just a way to stress test this work.
2014-09-02 10:30:04 -07:00
Shuxin Yang 1db717f783 some cleanup 2014-08-27 17:00:21 -07:00
Shuxin Yang f6c4ca0d94 This change introduces "block cache" to avoid the cost of TLB manipulation,
and page initialization via zero-filling.

  Suppose a allocated block B1, whose virtual address is [ad1, ad2], is going
to deallocated. One Linux, it seems the only way to deallocate the pages
associated with the block is to call madvise(..MADV_DONTNEED...) (
hereinafter, call it madvise() for short unless otherwise noted).

 madvise() *immediately* remove all the pages involved, and invalidate the
related TLB entries. So, if later on we allocate a block overlapping with
B1 in virtual address; accessing to the overlapping space will result in
re-establishing TLB entries, and zero-fill-pages, which is bit expensive.

 This cost can be reduced by keeping few blocks in memory, and re-use the
memory resident pages over and over again. This is the rationale behind the
"block cache". The "cache" here may be a misnomer; it dosen't cache any data,
it just provide a way to keep small sum of idle pages in memory to avoid
cost of TLB manipulation and page initialization via zero-filling.
2014-08-26 22:24:30 -07:00
Shuxin Yang e6c87e266c This trivial change is just to mark the revision which suprisely
give 2.5% speedup the bzip2 in SPEC2000int benchmark. 2.5% is kind of
big improve to bzip2. As of I write this commit log, I have no idea
where the speedup is coming from. This revision might expose some
opportunity of malloc implementation.

I only run bzip2 with only one ref-input, the "input.souce".

o. If I run bzip2 with following command:
    time -p (./bzip2 input.source 58 >run.source.out 2>run.source.err)
    the user time is 15.39s.

o. If I run the same command line but with ptmalloc3 on and ljmm off,
time -p (ENABLE_LJMM=0 LD_PRELOAD="/home/syang/develop/luajit/ljmm.gh/libptmalloc3.so /home/syang/develop/luajit/ljmm.gh/libadaptor.so" ./bzip2 input.source 58 >run.source.out 2>run.source.err)
    the user time is about the same (if not exactly the same).

  (this implies ptmalloc3 and the malloc implementatio in GNU libc 2.19
   have about the same performance).

o. However, if I change the above command line by flipping
   ENABLE_LJMM=0 to ENABLE_LJMM=1, time-command to 14.9s.
   (Yes, the ouput the command line *is* correct).

The performance improvement deserve a closer look.
2014-08-25 11:15:41 -07:00
Shuxin Yang bea77ba9cb Miscellaneous minor tweaks 2014-08-24 10:42:35 -07:00
Shuxin Yang 7ba100395c This change include two parts:
1. replace misnomer "trunk" with "chunk".
2. add a stress testing and benchmark infrastructure.
2014-08-22 11:28:53 -07:00
Shuxin Yang 08ed38ab98 Add another testing case for mremap().
As of this revision, this work is ready for stress testing.
2014-08-19 10:13:24 -07:00
Shuxin Yang ca0d7fa94d - Add a unit-test for lm_remap().
- Find few minor bugs.
2014-08-18 17:03:58 -07:00
Shuxin Yang de17def8a1 Add a unit-test for lm_mmap()/lm_malloc(). 2014-08-18 13:02:27 -07:00
Shuxin Yang 252b87f9fd Enable unit test 2.
Add files which should have been committed eariler.
2014-08-18 11:35:26 -07:00
Shuxin Yang c6cfc27f43 pass the 1st unit test 2014-08-15 16:04:47 -07:00
Shuxin Yang 76f82f6ad4 enable unit-test infra-structure 2014-08-15 13:06:49 -07:00
Shuxin Yang 48179af1f8 Add unit-test support. 2014-08-14 16:05:54 -07:00
Shuxin Yang 47ea0d44a9 add a banner for rb-tree search testing 2014-08-14 14:13:56 -07:00
Shuxin Yang b6f1258162 Divide page_alloc.c into two parts: one is still for page allocation, the other part is to implement
lm_mmap(), lm_munmap() and lm_remap().
2014-08-14 14:09:14 -07:00
Shuxin Yang 3e34a802c7 Fix bugs of rb-tree. The bug is about searching element with key no-less-than
or no-greater-than given key.
2014-08-14 11:49:33 -07:00
Shuxin Yang e912288905 Rudimentary implementation of lm_mremap() 2014-08-14 09:18:35 -07:00
Shuxin Yang 71f14207e8 Implement lm_unmap() features about unmapping leading or trailing partion
of mapped block. Unmapping middle portion of mapped area is not yet implemneted.

This change is not tested yet.
2014-08-13 15:14:10 -07:00
Shuxin Yang c266dd8f67 add rbt_search_variant which is able to search an element greater/less than a given key 2014-08-12 18:10:01 -07:00
Shuxin Yang 487d022aae Introduce page "id", which is a page "index" plus a non-negative number.
The index is ranging from 0 to the number-of-page-minus-1, while the id
is used to termine related "buddy" block.
2014-08-12 17:03:39 -07:00
Shuxin Yang 9e6507bd22 rudimentary implementation luajit mem-managment for taking full advantage of lower 2G memory 2014-08-07 11:05:29 -07:00
yangshuxin 31fab6612f Initial commit 2014-08-07 10:48:40 -07:00