4.115
Last change
on this file since 6c7caa1a was
23fec9f0,
checked in by Sebastian Huber <sebastian.huber@…>, on 03/27/14 at 13:16:12
|
score: PR2152: Use allocator mutex for objects
Use allocator mutex for objects allocate/free. This prevents that the
thread dispatch latency depends on the workspace/heap fragmentation.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Free Object |
---|
5 | * @ingroup ScoreObject |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
10 | * On-Line Applications Research Corporation (OAR). |
---|
11 | * |
---|
12 | * The license and distribution terms for this file may be |
---|
13 | * found in the file LICENSE in this distribution or at |
---|
14 | * http://www.rtems.org/license/LICENSE. |
---|
15 | */ |
---|
16 | |
---|
17 | #if HAVE_CONFIG_H |
---|
18 | #include "config.h" |
---|
19 | #endif |
---|
20 | |
---|
21 | #include <rtems/score/objectimpl.h> |
---|
22 | #include <rtems/score/assert.h> |
---|
23 | #include <rtems/score/chainimpl.h> |
---|
24 | |
---|
25 | void _Objects_Free( |
---|
26 | Objects_Information *information, |
---|
27 | Objects_Control *the_object |
---|
28 | ) |
---|
29 | { |
---|
30 | uint32_t allocation_size = information->allocation_size; |
---|
31 | |
---|
32 | _Assert( _Debug_Is_owner_of_allocator() ); |
---|
33 | |
---|
34 | _Chain_Append_unprotected( &information->Inactive, &the_object->Node ); |
---|
35 | |
---|
36 | if ( information->auto_extend ) { |
---|
37 | uint32_t block; |
---|
38 | |
---|
39 | block = (uint32_t) (_Objects_Get_index( the_object->id ) - |
---|
40 | _Objects_Get_index( information->minimum_id )); |
---|
41 | block /= information->allocation_size; |
---|
42 | |
---|
43 | information->inactive_per_block[ block ]++; |
---|
44 | information->inactive++; |
---|
45 | |
---|
46 | /* |
---|
47 | * Check if the threshold level has been met of |
---|
48 | * 1.5 x allocation_size are free. |
---|
49 | */ |
---|
50 | |
---|
51 | if ( information->inactive > ( allocation_size + ( allocation_size >> 1 ) ) ) { |
---|
52 | _Objects_Shrink_information( information ); |
---|
53 | } |
---|
54 | } |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.