Martin Quinson [Thu, 2 Feb 2012 20:44:21 +0000 (21:44 +0100)]
TODO--: the 'type' of each mmalloc block is granted to be uptodate at every point
Tomorrow, I'll add the fragment metadatas, and the backtraces.
For that, I'll waste a lot of space by adding a static tables to the
malloc_info structure, where the size of that table is the maximal
amount of fragments per block.
Something like BLOCKSIZE/sizeof(struct list) since mmalloc refuses to
allocate smaller blocks (to ensure that we can enlist free fragments).
This implementation of malloc will definitely not be something that
you want to use when not forced to do so to get the model-checking
working. But it will provide all the information that MC needs.
Martin Quinson [Thu, 2 Feb 2012 16:45:21 +0000 (17:45 +0100)]
Simplify the malloc_info structure containing the metadata of a given block in mmalloc
* Less structures in union in structure in union inception madness
We're using a less portable anonymous union, but gcc handles that
since maybe 15 years, so that should be cool.
* We can now determine from looking at it whether the block is busy or
free, without having to search in which list the block is.
That was useles to other usages of mmalloc, but this is very
interesting when comparing heaps.
Moreover, it comes for free: it has exactly the same (memory) cost
when the block is busy, and we have a plenty of place in the block
to store that this it free when it is actually free.
Please note that this information is not updated when the block is
freed yet. (splitting the commit just in case someone tries to read it
later: this one is almost automatic refactoring)
Martin Quinson [Wed, 1 Feb 2012 16:30:58 +0000 (17:30 +0100)]
Simplify the mmalloc library further
* Stop playing with void* for the heap descriptors and introduce the
xbt_mheap_t datatype for that.
* Don't try to make it work when mmalloc and friends are called with
NULL as a first argument.
I added a pimple that mmalloc_preinit returns the default mhead after
creating it to simplify the code of the legacy functions that check
that this default mhead exist or create it before using it.
This extra check should be useless if mmalloc_preinit were called soon
enough since it's in the critical path, but the performance of
model-checking is not a concern yet: only getting something working
matters for now.
Arnaud Giersch [Wed, 1 Feb 2012 14:11:55 +0000 (15:11 +0100)]
Reset t_simdata->comm after comm is over.
Fixes a segfault with chord on 100000 hosts, where the backtrace is:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b2bd2f in SIMIX_rdv_remove (comm=0x40bd4fd0, rdv=0x0) at ./src/simix/smx_network.c:117
117 xbt_fifo_remove(rdv->comm_fifo, comm);
(gdb) bt
#0 0x00007ffff7b2bd2f in SIMIX_rdv_remove (comm=0x40bd4fd0, rdv=0x0) at ./src/simix/smx_network.c:117
#1 SIMIX_comm_cancel (action=0x40bd4fd0) at ./src/simix/smx_network.c:754
#2 0x00007ffff7b4046e in SIMIX_simcall_pre (simcall=0x613c90, value=0) at ./src/simix/smx_smurf.c:126
#3 0x00007ffff7b407c6 in SIMIX_simcall_push (self=0x613c00) at ./src/simix/smx_smurf.c:26
#4 0x00007ffff7a83a8d in simcall_comm_cancel (comm=0x40bd4fd0) at ./src/simix/smx_user.c:830
#5 MSG_task_cancel (task=0x45ba4eb0) at ./src/msg/msg_task.c:223
#6 0x00007ffff7a83bc0 in MSG_task_destroy (task=0x45ba4eb0) at ./src/msg/msg_task.c:187
#7 0x00007ffff7ac3ebb in SIMIX_comm_destroy (action=0x42078370) at ./src/simix/smx_network.c:274
#8 0x00007ffff7a9603c in SIMIX_process_cleanup (process=0x1ce9da60) at ./src/simix/smx_process.c:87
#9 0x00007ffff7b40208 in SIMIX_simcall_pre (simcall=0x1ce9daf0, value=0) at ./src/simix/smx_smurf.c:323
#10 0x00007ffff7b2554e in SIMIX_run () at ./src/simix/smx_global.c:207
#11 0x00007ffff7b256e7 in MSG_main () at ./src/msg/msg_global.c:155
#12 0x000000000040180b in main (argc=3, argv=<optimized out>) at ./examples/msg/chord/chord.c:918
Git bisect identified commit 6dcde87 as culprit (Use isend
instead of send to set the simdata->comm so that get_remaining
can work.)
Arnaud Giersch [Wed, 1 Feb 2012 08:36:03 +0000 (09:36 +0100)]
Add more thorough tests for parmaps.
* all modes are tested;
* the "basic test" does some computations, and checks the results;
* the "extended test" tries to verify that all threads are working.
Arnaud Giersch [Wed, 1 Feb 2012 08:21:45 +0000 (09:21 +0100)]
Parmap review.
* synchronizations are made a bit simpler;
* helper functions are renamed for more clarity;
* synchronization at the end of xbt_parmap_new() is removed;
* the working loop is made faster by manually inlining xbt_parmap_next();
* finally, the posix mode is fixed.
Arnaud Giersch [Wed, 1 Feb 2012 08:00:35 +0000 (09:00 +0100)]
Remove static function attribute.
Fixes build error:
./src/surf/network.c:376:12: error: static declaration of ‘net_get_link_latency_limited’ follows non-static declaration
./src/surf/surf_private.h:81:5: note: previous declaration of ‘net_get_link_latency_limited’ was here
XBT supports sockets with explicit choice of the transport plugin.
XBT provides only one transport plugin: TCP (i.e. real sockets) and
allows other layers to write their custom plugins.
GRAS implements such custom plugins: simulated sockets and file sockets.
TCP sockets only existed in GRAS RL mode. They can now also be used in
GRAS SG mode.
More pieces of GRAS remain to be moved to XBT before TCP sockets can
also be used outside GRAS (e.g. in SIMIX 3, one day, to distribute the
simulation).
Martin Quinson [Tue, 31 Jan 2012 15:27:49 +0000 (16:27 +0100)]
Kill some unused features of mmalloc
- keys, which allow to store data directly in the malloc descriptor
- tracing, which displays what happends using the hooks. In addition
of being useless to us, it contained a FIXME indicating that this
implementation was partial.
SIMIX refactoring: replace 'request' by a more precise term: 'simcall'
All functions that make a system call (or simcall) are now simcall_*
(instead of SIMIX_req_*). They all interrupt the execution flow until
the kernel answers the simcall.
Let's hope that SIMIX will be easier to understand ;)