diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 5ee4f5c1de19..dcc57d84ed37 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -1227,9 +1227,6 @@ pipeclose(cpipe) * free resources */ pipe_free_kmem(cpipe); - /* XXX: erm, doesn't zalloc already have its own locks and - * not need the giant vm lock? - */ zfree(pipe_zone, cpipe); } } diff --git a/sys/sys/mutex.h b/sys/sys/mutex.h index eeca8dceec14..7c3c4125d390 100644 --- a/sys/sys/mutex.h +++ b/sys/sys/mutex.h @@ -383,10 +383,10 @@ do { \ KASSERT(curproc->p_giant_optional == 0, ("Giant not optional at %s: %d", __FILE__, __LINE__)); \ mtx_assert(&Giant, MA_OWNED); \ } while(0) -#define START_GIANT_DEPRECIATED(sysctlvar) \ +#define START_GIANT_DEPRECATED(sysctlvar) \ int __gotgiant = (curproc->p_giant_optional == 0 && sysctlvar) ? \ (mtx_lock(&Giant), 1) : 0 -#define END_GIANT_DEPRECIATED \ +#define END_GIANT_DEPRECATED \ if (__gotgiant) mtx_unlock(&Giant) #define START_GIANT_OPTIONAL \ ++curproc->p_giant_optional @@ -396,8 +396,8 @@ do { \ #else /* INVARIANTS */ #define mtx_assert(m, what) #define GIANT_REQUIRED -#define START_GIANT_DEPRECIATED(sysctl) -#define END_GIANT_DEPRECIATED +#define START_GIANT_DEPRECATED(sysctl) +#define END_GIANT_DEPRECATED #define START_GIANT_OPTIONAL #define END_GIANT_OPTIONAL #endif /* INVARIANTS */ diff --git a/sys/sys/proc.h b/sys/sys/proc.h index 78cfe4f5ce54..277fbee9a010 100644 --- a/sys/sys/proc.h +++ b/sys/sys/proc.h @@ -242,6 +242,7 @@ struct proc { void *p_aioinfo; /* (c) ASYNC I/O info. */ struct ithd *p_ithd; /* (b) For interrupt threads only. */ int p_intr_nesting_level; /* (k) Interrupt recursion. */ + int p_giant_optional; /* (i) Giant Lock Sanity */ /* End area that is zeroed on creation. */ #define p_endzero p_startcopy @@ -276,7 +277,6 @@ struct proc { struct pasleep p_asleep; /* (k) Used by asleep()/await(). */ void *p_emuldata; /* (c) Emulator state data. */ struct trapframe *p_frame; /* (k) */ - int p_giant_optional; /* (i) Giant Lock Sanity */ }; #define p_session p_pgrp->pg_session