|
From: <sv...@va...> - 2006-08-16 01:48:24
|
Author: sewardj
Date: 2006-08-16 02:48:19 +0100 (Wed, 16 Aug 2006)
New Revision: 6001
Log:
When a segment becomes free, and it is above aspacem_maxAddr, mark it
as SkResvn rather than SkFree, since doing otherwise causes the area
above aspacem_maxAddr - which starts out as SkResvn - to be polluted
with SkFree bits. Fixes an assertion failure found by Alex Bennee
(users list, 9 Aug 06).
Also allow the preener to merge fixed-sized SkResvns so as to avoid
fragmentation that otherwise results.
Modified:
trunk/coregrind/m_aspacemgr/aspacemgr.c
Modified: trunk/coregrind/m_aspacemgr/aspacemgr.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_aspacemgr/aspacemgr.c 2006-08-16 00:28:25 UTC (rev =
6000)
+++ trunk/coregrind/m_aspacemgr/aspacemgr.c 2006-08-16 01:48:19 UTC (rev =
6001)
@@ -994,6 +994,12 @@
case SkShmC:
return False;
=20
+ case SkResvn:
+ if (s1->smode =3D=3D SmFixed && s2->smode =3D=3D SmFixed) {
+ s1->end =3D s2->end;
+ return True;
+ }
+
default:
break;
=20
@@ -2232,9 +2238,22 @@
needDiscard =3D any_Ts_in_range( start, len );
=20
init_nsegment( &seg );
- seg.kind =3D SkFree;
seg.start =3D start;
seg.end =3D start + len - 1;
+
+ /* The segment becomes unused (free). Segments from above
+ aspacem_maxAddr were originally SkResvn and so we make them so
+ again. Note, this isn't really right when the segment straddles
+ the aspacem_maxAddr boundary - then really it should be split in
+ two, the lower part marked as SkFree and the upper part as
+ SkResvn. Ah well. */
+ if (start > aspacem_maxAddr=20
+ && /* check previous comparison is meaningful */
+ aspacem_maxAddr < Addr_MAX)
+ seg.kind =3D SkResvn;
+ else
+ seg.kind =3D SkFree;
+
add_segment( &seg );
=20
/* Unmapping could create two adjacent free segments, so a preen is
@@ -2984,9 +3003,17 @@
=20
/* Create a free hole in the old location. */
init_nsegment( &seg );
- seg.kind =3D SkFree;
seg.start =3D old_addr;
seg.end =3D old_addr + old_len - 1;
+ /* See comments in VG_(am_notify_munmap) about this SkResvn vs
+ SkFree thing. */
+ if (old_addr > aspacem_maxAddr=20
+ && /* check previous comparison is meaningful */
+ aspacem_maxAddr < Addr_MAX)
+ seg.kind =3D SkResvn;
+ else
+ seg.kind =3D SkFree;
+
add_segment( &seg );
=20
AM_SANITY_CHECK;
|