[pypy-commit] stmgc default: The nursery page's read markers are never read, but must still be writeable. We'd
arigo
noreply at buildbot.pypy.org
Thu Mar 27 14:23:21 CET 2014
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r1103:785dafe38e34
Date: 2014-03-27 14:07 +0100
http://bitbucket.org/pypy/stmgc/changeset/785dafe38e34/
Log: The nursery page's read markers are never read, but must still be
writeable. We'd like to map the pages to a general "trash page";
missing one, we remap all the pages over to the same one. We still
keep one page *per segment* to avoid cross-CPU cache conflicts.
diff --git a/c7/stm/core.h b/c7/stm/core.h
--- a/c7/stm/core.h
+++ b/c7/stm/core.h
@@ -28,6 +28,8 @@
#define READMARKER_START ((FIRST_OBJECT_PAGE * 4096UL) >> 4)
#define FIRST_READMARKER_PAGE (READMARKER_START / 4096UL)
+#define OLD_RM_START ((END_NURSERY_PAGE * 4096UL) >> 4)
+#define FIRST_OLD_RM_PAGE (OLD_RM_START / 4096UL)
#define NB_READMARKER_PAGES (FIRST_OBJECT_PAGE - FIRST_READMARKER_PAGE)
#define WRITELOCK_START ((END_NURSERY_PAGE * 4096UL) >> 4)
diff --git a/c7/stm/pages.c b/c7/stm/pages.c
--- a/c7/stm/pages.c
+++ b/c7/stm/pages.c
@@ -169,25 +169,22 @@
increment_total_allocated(total);
}
+static void pages_setup_readmarkers_for_nursery(void)
+{
+ /* The nursery page's read markers are never read, but must still
+ be writeable. We'd like to map the pages to a general "trash
+ page"; missing one, we remap all the pages over to the same one.
+ We still keep one page *per segment* to avoid cross-CPU cache
+ conflicts.
+ */
+ long i, j;
+ for (i = 1; i <= NB_SEGMENTS; i++) {
+ char *segment_base = get_segment_base(i);
-#if 0
-static bool is_fully_in_shared_pages(object_t *obj)
-{
- uintptr_t first_page = ((uintptr_t)obj) / 4096UL;
-
- if ((obj->stm_flags & GCFLAG_SMALL_UNIFORM) != 0)
- return (flag_page_private[first_page] == SHARED_PAGE);
-
- ssize_t obj_size = stmcb_size_rounded_up(
- (struct object_s *)REAL_ADDRESS(stm_object_pages, obj));
-
- uintptr_t last_page = (((uintptr_t)obj) + obj_size - 1) / 4096UL;
-
- do {
- if (flag_page_private[first_page++] != SHARED_PAGE)
- return false;
- } while (first_page <= last_page);
-
- return true;
+ for (j = FIRST_READMARKER_PAGE + 1; j < FIRST_OLD_RM_PAGE; j++) {
+ remap_file_pages(segment_base + 4096 * j, 4096, 0,
+ i * NB_PAGES + FIRST_READMARKER_PAGE, 0);
+ /* errors here ignored */
+ }
+ }
}
-#endif
diff --git a/c7/stm/pages.h b/c7/stm/pages.h
--- a/c7/stm/pages.h
+++ b/c7/stm/pages.h
@@ -39,6 +39,7 @@
static void page_privatize(uintptr_t pagenum);
static void page_reshare(uintptr_t pagenum);
static void _page_do_reshare(long segnum, uintptr_t pagenum);
+static void pages_setup_readmarkers_for_nursery(void);
/* Note: don't ever do "mutex_pages_lock(); mutex_lock()" in that order */
static void mutex_pages_lock(void);
diff --git a/c7/stm/setup.c b/c7/stm/setup.c
--- a/c7/stm/setup.c
+++ b/c7/stm/setup.c
@@ -36,6 +36,7 @@
(FIRST_READMARKER_PAGE - 2) * 4096UL,
PROT_NONE);
}
+ pages_setup_readmarkers_for_nursery();
}
void stm_setup(void)
More information about the pypy-commit
mailing list