mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-23 10:57:14 +08:00
Avoid use of "hogticks"
This commit is contained in:
parent
adaa24668e
commit
371881668c
@ -53,16 +53,12 @@ __FBSDID("$FreeBSD$");
|
|||||||
#include <sys/resourcevar.h>
|
#include <sys/resourcevar.h>
|
||||||
#include <sys/sched.h>
|
#include <sys/sched.h>
|
||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#ifndef __rtems__
|
|
||||||
#include <sys/vnode.h>
|
#include <sys/vnode.h>
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <vm/vm.h>
|
#include <vm/vm.h>
|
||||||
#include <vm/vm_page.h>
|
#include <vm/vm_page.h>
|
||||||
#include <vm/vm_map.h>
|
#include <vm/vm_map.h>
|
||||||
#ifdef __rtems__
|
|
||||||
#include <sys/uio.h>
|
#include <sys/uio.h>
|
||||||
#endif
|
|
||||||
#ifdef ZERO_COPY_SOCKETS
|
#ifdef ZERO_COPY_SOCKETS
|
||||||
#include <vm/vm_param.h>
|
#include <vm/vm_param.h>
|
||||||
#include <vm/vm_object.h>
|
#include <vm/vm_object.h>
|
||||||
@ -136,17 +132,20 @@ retry:
|
|||||||
return(KERN_SUCCESS);
|
return(KERN_SUCCESS);
|
||||||
}
|
}
|
||||||
#endif /* ZERO_COPY_SOCKETS */
|
#endif /* ZERO_COPY_SOCKETS */
|
||||||
|
|
||||||
#endif /* __rtems__ */
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
int
|
int
|
||||||
uiomove(void *cp, int n, struct uio *uio)
|
uiomove(void *cp, int n, struct uio *uio)
|
||||||
{
|
{
|
||||||
|
#ifndef __rtems__
|
||||||
struct thread *td = curthread;
|
struct thread *td = curthread;
|
||||||
|
#endif /* __rtems__ */
|
||||||
struct iovec *iov;
|
struct iovec *iov;
|
||||||
u_int cnt;
|
u_int cnt;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
#ifndef __rtems__
|
||||||
int save = 0;
|
int save = 0;
|
||||||
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
|
KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE,
|
||||||
("uiomove: mode"));
|
("uiomove: mode"));
|
||||||
@ -158,7 +157,7 @@ uiomove(void *cp, int n, struct uio *uio)
|
|||||||
#ifndef __rtems__
|
#ifndef __rtems__
|
||||||
save = td->td_pflags & TDP_DEADLKTREAT;
|
save = td->td_pflags & TDP_DEADLKTREAT;
|
||||||
td->td_pflags |= TDP_DEADLKTREAT;
|
td->td_pflags |= TDP_DEADLKTREAT;
|
||||||
#endif
|
#endif /* __rtems__ */
|
||||||
|
|
||||||
while (n > 0 && uio->uio_resid) {
|
while (n > 0 && uio->uio_resid) {
|
||||||
iov = uio->uio_iov;
|
iov = uio->uio_iov;
|
||||||
@ -174,8 +173,10 @@ uiomove(void *cp, int n, struct uio *uio)
|
|||||||
switch (uio->uio_segflg) {
|
switch (uio->uio_segflg) {
|
||||||
|
|
||||||
case UIO_USERSPACE:
|
case UIO_USERSPACE:
|
||||||
|
#ifndef __rtems__
|
||||||
if (ticks - PCPU_GET(switchticks) >= hogticks)
|
if (ticks - PCPU_GET(switchticks) >= hogticks)
|
||||||
uio_yield();
|
uio_yield();
|
||||||
|
#endif /* __rtems__ */
|
||||||
if (uio->uio_rw == UIO_READ)
|
if (uio->uio_rw == UIO_READ)
|
||||||
error = copyout(cp, iov->iov_base, cnt);
|
error = copyout(cp, iov->iov_base, cnt);
|
||||||
else
|
else
|
||||||
@ -204,7 +205,7 @@ out:
|
|||||||
#ifndef __rtems__
|
#ifndef __rtems__
|
||||||
if (save == 0)
|
if (save == 0)
|
||||||
td->td_pflags &= ~TDP_DEADLKTREAT;
|
td->td_pflags &= ~TDP_DEADLKTREAT;
|
||||||
#endif
|
#endif /* __rtems__ */
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,6 +467,7 @@ phashinit(int elements, struct malloc_type *type, u_long *nentries)
|
|||||||
return (hashtbl);
|
return (hashtbl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __rtems__
|
||||||
void
|
void
|
||||||
uio_yield(void)
|
uio_yield(void)
|
||||||
{
|
{
|
||||||
@ -473,18 +475,14 @@ uio_yield(void)
|
|||||||
|
|
||||||
td = curthread;
|
td = curthread;
|
||||||
DROP_GIANT();
|
DROP_GIANT();
|
||||||
#ifndef __rtems__
|
|
||||||
thread_lock(td);
|
thread_lock(td);
|
||||||
sched_prio(td, td->td_user_pri);
|
sched_prio(td, td->td_user_pri);
|
||||||
mi_switch(SW_INVOL | SWT_RELINQUISH, NULL);
|
mi_switch(SW_INVOL | SWT_RELINQUISH, NULL);
|
||||||
thread_unlock(td);
|
thread_unlock(td);
|
||||||
#else /* __rtems__ */
|
|
||||||
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
|
rtems_task_wake_after(RTEMS_YIELD_PROCESSOR);
|
||||||
#endif /* __rtems__ */
|
|
||||||
PICKUP_GIANT();
|
PICKUP_GIANT();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef __rtems__
|
|
||||||
int
|
int
|
||||||
copyinfrom(const void * __restrict src, void * __restrict dst, size_t len,
|
copyinfrom(const void * __restrict src, void * __restrict dst, size_t len,
|
||||||
int seg)
|
int seg)
|
||||||
|
@ -54,7 +54,6 @@ int ngroups_max = NGROUPS_MAX; /* XXX */
|
|||||||
int maxfiles = 7; /* XXX sys. wide open files limit */
|
int maxfiles = 7; /* XXX sys. wide open files limit */
|
||||||
int maxfilesperproc = 27; /* XXX per-proc open files limit */
|
int maxfilesperproc = 27; /* XXX per-proc open files limit */
|
||||||
uintptr_t dpcpu_off[MAXCPU];
|
uintptr_t dpcpu_off[MAXCPU];
|
||||||
int hogticks = 2; /* hogticks = 2 * sched_quantum */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
critical_enter(void)
|
critical_enter(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user