proc: load/store p_cowgen using atomic primitives
This commit is contained in:
parent
29ee49f66b
commit
b53133a778
@ -309,7 +309,7 @@ trap(struct trapframe *frame)
|
||||
td->td_pticks = 0;
|
||||
td->td_frame = frame;
|
||||
addr = frame->tf_rip;
|
||||
if (td->td_cowgen != p->p_cowgen)
|
||||
if (td->td_cowgen != atomic_load_int(&p->p_cowgen))
|
||||
thread_cow_update(td);
|
||||
|
||||
switch (type) {
|
||||
|
@ -418,7 +418,7 @@ abort_handler(struct trapframe *tf, int prefetch)
|
||||
p = td->td_proc;
|
||||
if (usermode) {
|
||||
td->td_pticks = 0;
|
||||
if (td->td_cowgen != p->p_cowgen)
|
||||
if (td->td_cowgen != atomic_load_int(&p->p_cowgen))
|
||||
thread_cow_update(td);
|
||||
}
|
||||
|
||||
|
@ -301,7 +301,7 @@ trap(struct trapframe *frame)
|
||||
td->td_pticks = 0;
|
||||
td->td_frame = frame;
|
||||
addr = frame->tf_eip;
|
||||
if (td->td_cowgen != p->p_cowgen)
|
||||
if (td->td_cowgen != atomic_load_int(&p->p_cowgen))
|
||||
thread_cow_update(td);
|
||||
|
||||
switch (type) {
|
||||
|
@ -68,7 +68,7 @@ syscallenter(struct thread *td)
|
||||
sa = &td->td_sa;
|
||||
|
||||
td->td_pticks = 0;
|
||||
if (__predict_false(td->td_cowgen != p->p_cowgen))
|
||||
if (__predict_false(td->td_cowgen != atomic_load_int(&p->p_cowgen)))
|
||||
thread_cow_update(td);
|
||||
traced = (p->p_flag & P_TRACED) != 0;
|
||||
if (__predict_false(traced || td->td_dbgflags & TDB_USERWR)) {
|
||||
|
@ -247,7 +247,7 @@ ast(struct trapframe *framep)
|
||||
thread_unlock(td);
|
||||
VM_CNT_INC(v_trap);
|
||||
|
||||
if (td->td_cowgen != p->p_cowgen)
|
||||
if (td->td_cowgen != atomic_load_int(&p->p_cowgen))
|
||||
thread_cow_update(td);
|
||||
if (td->td_pflags & TDP_OWEUPC && p->p_flag & P_PROFIL) {
|
||||
addupc_task(td, td->td_profil_addr, td->td_profil_ticks);
|
||||
|
@ -254,7 +254,7 @@ trap(struct trapframe *frame)
|
||||
td->td_pticks = 0;
|
||||
td->td_frame = frame;
|
||||
addr = frame->srr0;
|
||||
if (td->td_cowgen != p->p_cowgen)
|
||||
if (td->td_cowgen != atomic_load_int(&p->p_cowgen))
|
||||
thread_cow_update(td);
|
||||
|
||||
/* User Mode Traps */
|
||||
|
@ -1005,8 +1005,9 @@ extern pid_t pid_max;
|
||||
} while (0)
|
||||
|
||||
#define PROC_UPDATE_COW(p) do { \
|
||||
PROC_LOCK_ASSERT((p), MA_OWNED); \
|
||||
(p)->p_cowgen++; \
|
||||
struct proc *_p = (p); \
|
||||
PROC_LOCK_ASSERT((_p), MA_OWNED); \
|
||||
atomic_store_int(&_p->p_cowgen, _p->p_cowgen + 1); \
|
||||
} while (0)
|
||||
|
||||
#define PROC_COW_CHANGECOUNT(td, p) ({ \
|
||||
|
Loading…
Reference in New Issue
Block a user