[erlang-patches] [PATCH] erts: reduce smp locking time range in erts_garbage_collect

Jovi Zhang bookjovi@REDACTED
Fri Dec 16 11:13:19 CET 2011


>From f8bb268d962808c6e64545afbbd0d2b0257afdb7 Mon Sep 17 00:00:00 2001
From: Jovi Zhang <bookjovi@REDACTED>
Date: Fri, 9 Dec 2011 05:46:45 +0800
Subject: [PATCH] erts: reduce smp locking time range in erts_garbage_collect

get_now should be use out of process status locking, then
it can reduce smp locking time range in here.
---
erts/emulator/beam/erl_gc.c |    3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index eb2b945..bcda3bf 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -357,10 +357,11 @@ erts_garbage_collect(Process* p, int need,
Eterm* objv, int nobj)
    erts_smp_proc_lock(p, ERTS_PROC_LOCK_STATUS);
    p->gcstatus = p->status;
    p->status = P_GARBING;
+    erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS);
+
    if (erts_system_monitor_long_gc != 0) {
       get_now(&ms1, &s1, &us1);
    }
-    erts_smp_proc_unlock(p, ERTS_PROC_LOCK_STATUS);

    ERTS_CHK_OFFHEAP(p);

--
1.7.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-erts-reduce-smp-locking-time-range-in-erts_garbage_c.patch
Type: application/octet-stream
Size: 1020 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20111216/86d77d67/attachment.obj>


More information about the erlang-patches mailing list